xsha1-0.0.0: cryptanalysis of Blizzard's broken SHA-1 implementation.

Safe HaskellSafe-Infered



Compression stage. Padding - extension - compression.

See http://en.wikipedia.org/wiki/Sha1 for the real thing.

Forward and reverse of a single round is implemented, to perform the full thing just foldl over [0..79].



type Regs = (N, N, N, N, N)Source

consts :: RegsSource

Initial values for registers a..e.

Also get added to the registers at the end.

f :: Int -> N -> N -> N -> NSource

Round function f, with round number and three of the registers.

k :: Int -> NSource

Round constant k.

iter :: Vector N -> Regs -> Int -> RegsSource

One round of the XSHA1 compression function.

reti :: Vector N -> Regs -> Int -> RegsSource

Inverse of the round function.

finalize :: Regs -> RegsSource

Does the last step, a weird addition thrown in for obfuscation.