md5.bend checks
raw source on the hub · import 0xd6fc55bf65b187fec4175f80d08c165a/md5.bend as Md5
MD5 (RFC 1321) and HMAC-MD5 (RFC 2104), for AUTH CRAM-MD5 (RFC 2195) only: MD5 is broken as a hash, and CRAM-MD5 is kept for old servers. Bytes are U32s below 256; a block is 16 little-endian words.
1 import
import Base
Types
type Md5 source · line 66 · raw
Data
The four words of the state.
Md5@a:U32 -> @b:U32 -> @c:U32 -> @d:U32 -> Md5
Definitions
def Md5.pick source · line 6 · raw
@c:Bool -> @a:U32 -> @b:U32 -> U32
def Md5.rotl source · line 14 · raw
@+x:U32 -> @+n:U32 -> U32
x rotated left by n bits (0 < n < 32).
def Md5.k source · line 18 · raw
List<&2, U32>
The round constants: floor(2^32 * abs(sin(i + 1))).
def Md5.s source · line 32 · raw
@+i:U32 -> U32
The shift of step i.
def Md5.g source · line 43 · raw
@+i:U32 -> U32
The index of the message word step i reads.
def Md5.f source · line 49 · raw
@+i:U32 -> @+b:U32 -> @+c:U32 -> @+d:U32 -> U32
The round function of step i.
def Md5.at.or source · line 55 · raw
@m:Maybe<&2, U32> -> U32
def Md5.at source · line 62 · raw
@xs:List<&2, U32> -> @i:U32 -> U32
def Md5.steps source · line 70 · raw
@ks:List<&2, U32> -> @+i:U32 -> @+m:List<&2, U32> -> @st:Md5 -> Md5
The 64 steps over one block; ks: the constants still to use.
def Md5.sum source · line 80 · raw
@x:Md5 -> @y:Md5 -> Md5
def Md5.words source · line 86 · raw
@n:Nat -> @bs:List<&2, U32> -> List<&2, U32>
The first 16 words of a byte list, and the bytes after them.
def Md5.blocks source · line 95 · raw
@fuel:Nat -> @+bs:List<&2, U32> -> @+st:Md5 -> Md5
Every 64-byte block folded into the state; fuel: the block count.
def Md5.zeros source · line 103 · raw
@n:Nat -> List<&2, U32>
def Md5.le source · line 111 · raw
@+x:U32 -> List<&2, U32>
A word's four bytes, little-endian.
def Md5.pad source · line 117 · raw
@+bs:List<&2, U32> -> List<&2, U32>
The message padded: a 1 bit, zeros up to 56 mod 64, the bit length in 64 bits (messages here are far below 512 MB, so its high word is 0).
def Md5.out source · line 123 · raw
@st:Md5 -> List<&2, U32>
def Md5.run source · line 128 · raw
@+p:List<&2, U32> -> List<&2, U32>
def Md5.hash source · line 133 · raw
@bs:List<&2, U32> -> List<&2, U32>
The 16 bytes of the MD5 of bs.
def Md5.xors source · line 139 · raw
@bs:List<&2, U32> -> @+x:U32 -> List<&2, U32>
def Md5.key source · line 147 · raw
@+k:List<&2, U32> -> List<&2, U32>
The key as one 64-byte block: hashed if longer, zero-filled if shorter.
def Md5.hmac source · line 153 · raw
@key:List<&2, U32> -> @text:List<&2, U32> -> List<&2, U32>
HMAC-MD5 (RFC 2104): H((K xor opad) + H((K xor ipad) + text)).
def Md5.digit source · line 158 · raw
@+d:U32 -> Char
def Md5.hex source · line 162 · raw
@bs:List<&2, U32> -> String
Bytes as lower-case hex.