~/bend-docscommunity

src/crypto/blake/blake2b/sized.bend checks

raw source on the hub · import 0xd9a2fae439ac7ff9e21e0853948f94fe/src/crypto/blake/blake2b/sized.bend as Sized

3 imports
import Base
import ./types.bend as T
import ./blake2b.bend as B

Definitions

def word source · line 12 · raw

@+b0:U32 -> @+b1:U32 -> @+b2:U32 -> @+b3:U32 -> U32

Four little-endian bytes as one word.

def words source · line 16 · raw

@bs:List<&2, U32> -> List<&2, U32>

The bytes packed four per word, the last word zero-padded.

def fill source · line 29 · raw

@ws:List<&2, U32> -> @+i:U32 -> @a:Array<U32> -> Array<U32>

def pw source · line 36 · raw

@k:Nat -> Nat

def depth_go source · line 44 · raw

@fuel:Nat -> @+n:Nat -> @+d:Nat -> @done:Bool -> Nat

The smallest d >= k with 2^d >= n.

def depth source · line 53 · raw

@+n:Nat -> Nat

def pack source · line 57 · raw

@bs:List<&2, U32> -> Array<U32>

The packed array of the bytes.

def initial source · line 62 · raw

@+nn:U32 -> 0xd9a2fae439ac7ff9e21e0853948f94fe/src/crypto/blake/blake2b/types.Chain

h[0] ^= 0x01010000 ^ nn: the parameter block of an unkeyed hash with nn bytes.

def le source · line 65 · raw

@+w:U32 -> List<&2, U32>

def lane_bytes source · line 68 · raw

@l:0xd9a2fae439ac7ff9e21e0853948f94fe/src/crypto/blake/blake2b/types.Lane -> List<&2, U32>

def chain_bytes source · line 74 · raw

@h:0xd9a2fae439ac7ff9e21e0853948f94fe/src/crypto/blake/blake2b/types.Chain -> List<&2, U32>

The 64 little-endian bytes of the chaining value.

def chain source · line 81 · raw

@+nn:Nat -> @a:Array<U32> -> @+ll:Nat -> 0xd9a2fae439ac7ff9e21e0853948f94fe/src/crypto/blake/blake2b/types.Chain

The chaining value after every block: dd - 1 = (ll - 1) div 128 full blocks, then the last one (RFC 7693 section 3.3).

def hash source · line 86 · raw

@+nn:Nat -> @+bs:List<&2, U32> -> List<&2, U32>

BLAKE2b with an nn-byte digest (1 <= nn <= 64) of the bytes.