Created
May 11, 2014 19:29
-
-
Save sellout/113f24df29a922d23fee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- error: expected: "{", | |
-- function declaration | |
-- | M = MD5 (zipWith (+) [A, B, C, D] (loop 64 [A, B, C, D])) | |
updateMD5Context : MessageDigest5 -> Bits 512 -> MessageDigest5 | |
updateMD5Context (MD5 [A, B, C, D]) chunk with (the (Vect 16 (Bits 32)) (partition chunk)) | |
| M = MD5 (zipWith (+) [A, B, C, D] (loop 64 [A, B, C, D])) | |
where loop : Fin 65 -> Vect 4 (Bits 32) -> Vect 4 (Bits 32) | |
loop fZ context = context | |
loop (fS x) [A, B, C, D] = | |
let i = (the (Fin 64) last) `Prelude.Fin.(-)` x | |
in let iNat = finToNat i | |
in let (F, g) = | |
if iNat < 16 | |
then ((B `and` C) `or` (complement B `and` D), | |
iNat `tightmod` 16) | |
else if iNat < 32 | |
then ((D `and` B) `or` (complement D `and` C), | |
(iNat*5 + 1) `tightmod` 16) | |
else if iNat < 48 | |
then (B `xor` (C `xor` D), | |
(iNat*3 + 5) `tightmod` 16) | |
else (C `xor` (B `or` complement D), | |
(iNat*7) `tightmod` 16) | |
in loop (weaken x) | |
[C, | |
B, | |
B + rotateLeft (A `plus` F `plus` index i K `plus` index g M) | |
(index i s), | |
D] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got this to load: