ripemd160.bend checks
raw source on the hub · import bend-osdev-hashes@0.1.0.0/ripemd160.bend as Ripemd160
RIPEMD-160 (H. Dobbertin, A. Bosselaers and B. Preneel, "RIPEMD-160: A Strengthened Version of RIPEMD", Fast Software Encryption 1996, LNCS 1039, pp. 71-82, and its pseudo-code appendix): a 160-bit digest of 64-byte blocks, two parallel lines of five rounds of sixteen steps each, combined at the end (the word orders r and r', rotations s and s' and constants K and K' of the paper, unrolled by gen/rounds.py). Little-endian words and length, as MD4.
The hash, as the crypto package's hash interface takes it: ~Hs.HsMdState<Hs.HsW5>, ~64n, ~20n, ~HsRipemd160.init(), ~HsRipemd160.update, ~HsRipemd160.final, ~HsRipemd160.digest
3 imports
import Base import bend-osdev-bytes@0.1.0.0/bytes.bend as B import ./hashes.bend as Hs
Definitions
def hs.rmd.f1 source · line 18 · raw
@x:U32 -> @y:U32 -> @z:U32 -> U32
the functions f1 to f5 (the left line uses them in that order, the right line in the reverse order)
def hs.rmd.f2 source · line 21 · raw
@+x:U32 -> @y:U32 -> @z:U32 -> U32
def hs.rmd.f3 source · line 24 · raw
@x:U32 -> @y:U32 -> @z:U32 -> U32
def hs.rmd.f4 source · line 27 · raw
@x:U32 -> @y:U32 -> @+z:U32 -> U32
def hs.rmd.f5 source · line 30 · raw
@x:U32 -> @y:U32 -> @z:U32 -> U32
def hs.rmd.step source · line 34 · raw
@a:U32 -> @f:U32 -> @x:U32 -> @k:U32 -> @+s:Nat -> @e:U32 -> U32
one step: ((a + f + X[r] + K) <<< s) + e
def hs.ripemd160.rounds source · line 38 · raw
@x:0xd04c3185dce130521497bf85ab03f249/hashes.HsW16 -> @cv:0xd04c3185dce130521497bf85ab03f249/hashes.HsW5 -> 0xd04c3185dce130521497bf85ab03f249/hashes.HsW5
BEGIN GENERATED by gen/rounds.py: ripemd160
def HsRipemd160.iv source · line 375 · raw
0xd04c3185dce130521497bf85ab03f249/hashes.HsW5
The chaining value before any block
def HsRipemd160.compress source · line 380 · raw
@cv:0xd04c3185dce130521497bf85ab03f249/hashes.HsW5 -> @blk:List<&2, U32> -> 0xd04c3185dce130521497bf85ab03f249/hashes.HsW5
One 64-byte block (a list of another length is read as zero words: the engine passes only whole blocks)
def HsRipemd160.init source · line 383 · raw
0xd04c3185dce130521497bf85ab03f249/hashes.HsMdState<0xd04c3185dce130521497bf85ab03f249/hashes.HsW5>
def HsRipemd160.update source · line 386 · raw
@s:0xd04c3185dce130521497bf85ab03f249/hashes.HsMdState<0xd04c3185dce130521497bf85ab03f249/hashes.HsW5> -> @o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> 0xd04c3185dce130521497bf85ab03f249/hashes.HsMdState<0xd04c3185dce130521497bf85ab03f249/hashes.HsW5>
def HsRipemd160.final source · line 391 · raw
@s:0xd04c3185dce130521497bf85ab03f249/hashes.HsMdState<0xd04c3185dce130521497bf85ab03f249/hashes.HsW5> -> 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets
the digest of the bytes so far: MD4's padding, then the five words little-endian
def HsRipemd160.digest source · line 395 · raw
@o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets
The digest in one call