octets.bend checks
raw source on the hub · import bend-osdev-crypto@0.1.0.0/octets.bend as Octets
Byte-string helpers the modes and MACs share: XOR of two byte strings, a byte repeated, and a message cut into pieces of a block size.
2 imports
import Base import bend-osdev-bytes@0.1.0.0/bytes.bend as B
Definitions
def cr.oct.xorl source · line 8 · raw
@xs:List<&2, U32> -> @ys:List<&2, U32> -> List<&2, U32>
xs xor ys, element by element, over xs's length (a missing element of ys counts as 0)
def CrOct.xor source · line 20 · raw
@a:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> @b:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets
a xor b, byte by byte, over a's length (b's missing bytes count as 0)
def cr.oct.rep source · line 23 · raw
@n:Nat -> @+b:U32 -> List<&2, U32>
def CrOct.rep source · line 31 · raw
@n:Nat -> @+b:U32 -> 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets
the byte b, n times
def cr.oct.rev source · line 34 · raw
@xs:List<&2, U32> -> @acc:List<&2, U32> -> List<&2, U32>
def cr.oct.revs source · line 41 · raw
@xs:List<&2, List<&2, U32>> -> @acc:List<&2, List<&2, U32>> -> List<&2, List<&2, U32>>
def cr.oct.flush source · line 48 · raw
@cur:List<&2, U32> -> @acc:List<&2, List<&2, U32>> -> List<&2, List<&2, U32>>
def cr.oct.pieces.step source · line 55 · raw
@full:Bool -> @+c:List<&2, U32> -> @acc:List<&2, List<&2, U32>> -> List<&2, List<&2, U32>>
def cr.oct.pieces.cur source · line 62 · raw
@full:Bool -> @+c:List<&2, U32> -> List<&2, U32>
def cr.oct.pieces.i source · line 69 · raw
@full:Bool -> @+i:Nat -> Nat
def cr.oct.pieces.go source · line 78 · raw
@xs:List<&2, U32> -> @+n:Nat -> @+i:Nat -> @+cur:List<&2, U32> -> @acc:List<&2, List<&2, U32>> -> List<&2, List<&2, U32>>
the pieces of xs, last first: whole n-byte pieces, then what is left (cur: the piece being filled, reversed, i bytes long)
def CrOct.pieces source · line 89 · raw
@n:Nat -> @xs:List<&2, U32> -> List<&2, List<&2, U32>>
xs cut into pieces of n bytes, in order: every piece but the last has n bytes, the last 1 to n (no pieces for no bytes)