~/bend-docscommunity

check.bend checks

raw source on the hub · import bend-osdev-blowfish@0.1.0.0/check.bend as Check

Blowfish: six of Schneier's vectors (keys of 8, 1, 3 and 24 bytes), both ways (the ciphertext, then the plaintext decrypted back), and Blowfish through modes64.bend's CBC over 16 KB both ways.

5 imports
import Base
import bend-osdev-bytes@0.1.1.0/bytes.bend as B
import bend-osdev-cipher-core@0.1.0.0/cipher_core.bend as L
import bend-osdev-cipher-core@0.1.0.0/modes64.bend as X
import ./blowfish.bend as BF

Definitions

def err source · line 10 · raw

@e:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcError -> String

def b64.of source · line 19 · raw

@m:Maybe<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64

def b64 source · line 26 · raw

@o:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64

def blowfish_key source · line 40 · raw

@k:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> 0xa017fd0d7ab5be03e837cd7fd69dcdfd/blowfish.LcBlowfishKey

def blowfish source · line 43 · raw

@k:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> @b:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> String

def big.go source · line 47 · raw

@n:Nat -> @+i:U32 -> @acc:List<&2, U32> -> List<&2, U32>

n bytes, byte i = 7i + 3 (mod 256)

def big source · line 54 · raw

@n:Nat -> 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets

def verdict source · line 57 · raw

@b:Bool -> String

def last8 source · line 64 · raw

@r:Result<&2, &2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcError, 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets> -> String

def same64 source · line 71 · raw

@r:Result<&2, &2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcError, 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets> -> @+m:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> String

def blowfish_cbc source · line 83 · raw

@k:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> @n:Nat -> String

def main source · line 87 · raw

IO(Unit)

BEGIN GENERATED by gen/vectors.py: check

Templates

template key source · line 29 · raw

@-K:Data -> @r:Result<&2, &2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcError, K> -> @d:K -> K

template both64 source · line 36 · raw

@-K:Data -> @-enc:(@_:K -> @_:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64) -> @-dec:(@_:K -> @_:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64) -> @+k:K -> @b:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> String

template cbc64 source · line 78 · raw

@-K:Data -> @-enc:(@_:K -> @_:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64) -> @-dec:(@_:K -> @_:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64) -> @+k:K -> @n:Nat -> String