src/math/random/chacha8.bend checks
raw source on the hub · import 0xd9a2fae439ac7ff9e21e0853948f94fe/src/math/random/chacha8.bend as Chacha8
3 imports
import Base import ../u64.bend as W import ./chacha8/block.bend as B
Types
type Phase source · line 30 · raw
Data
the next group of the iteration: blocks 0-3, 4-7, 8-11 or 12-15
G0Phase
G1Phase
G2Phase
G3Phase
type ChaCha8 source · line 36 · raw
Data
C@key:0xd9a2fae439ac7ff9e21e0853948f94fe/src/math/random/chacha8/block.Key -> @phase:Phase -> @buf:List<&2, 0xd9a2fae439ac7ff9e21e0853948f94fe/src/math/u64.U64> -> ChaCha8
Definitions
def zero source · line 39 · raw
0xd9a2fae439ac7ff9e21e0853948f94fe/src/math/u64.U64
def of_key source · line 42 · raw
@k:0xd9a2fae439ac7ff9e21e0853948f94fe/src/math/random/chacha8/block.Key -> ChaCha8
def rekey source · line 46 · raw
@l:List<&2, 0xd9a2fae439ac7ff9e21e0853948f94fe/src/math/u64.U64> -> 0xd9a2fae439ac7ff9e21e0853948f94fe/src/math/random/chacha8/block.Key
the key of the next iteration: the last four words of the last group
def last source · line 54 · raw
@+g:List<&2, 0xd9a2fae439ac7ff9e21e0853948f94fe/src/math/u64.U64> -> ChaCha8
the last group: 28 words of output, then the next key
def refill source · line 57 · raw
@+k:0xd9a2fae439ac7ff9e21e0853948f94fe/src/math/random/chacha8/block.Key -> @p:Phase -> ChaCha8
def pop source · line 68 · raw
@g:ChaCha8 -> Pair(0xd9a2fae439ac7ff9e21e0853948f94fe/src/math/u64.U64, ChaCha8)
def next source · line 78 · raw
@g:ChaCha8 -> Pair(0xd9a2fae439ac7ff9e21e0853948f94fe/src/math/u64.U64, ChaCha8)
the next 64-bit output (a refill always yields a nonempty buffer)
def le32 source · line 90 · raw
@+b0:U32 -> @+b1:U32 -> @+b2:U32 -> @+b3:U32 -> U32
the little-endian word of four bytes (Go's byteorder.LEUint32)
def all_bytes source · line 93 · raw
@bs:List<&2, U32> -> Bool
def key_of source · line 100 · raw
@bs:List<&2, U32> -> Maybe<&2, 0xd9a2fae439ac7ff9e21e0853948f94fe/src/math/random/chacha8/block.Key>
def lift source · line 107 · raw
@m:Maybe<&2, 0xd9a2fae439ac7ff9e21e0853948f94fe/src/math/random/chacha8/block.Key> -> Maybe<&2, ChaCha8>
def seed_ok source · line 114 · raw
@bs:List<&2, U32> -> @ok:Bool -> Maybe<&2, ChaCha8>
def new source · line 122 · raw
@+seed:List<&2, U32> -> Maybe<&2, ChaCha8>
Go's NewChaCha8(seed): the seed is 32 bytes, each below 256