summaryrefslogtreecommitdiff
path: root/lib/crypto
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-10-03 09:58:56 -0700
committerOri Bernstein <ori@eigenstate.org>2018-10-03 09:58:56 -0700
commitf6eb57283f625cbd20d5bb423331e88ddc82c8f1 (patch)
tree6e729f2e26172c343b40dd91d40bdceebace57b4 /lib/crypto
parent100d3a203f8ee81adc5e31adac2d2c6c0ce65e5f (diff)
downloadmc-f6eb57283f625cbd20d5bb423331e88ddc82c8f1.tar.gz
Unswap sha output bytes. (Thanks Mike!)
Diffstat (limited to 'lib/crypto')
-rw-r--r--lib/crypto/sha1.myr8
-rw-r--r--lib/crypto/test/sha1.myr8
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/crypto/sha1.myr b/lib/crypto/sha1.myr
index 2cf71f0..0494f35 100644
--- a/lib/crypto/sha1.myr
+++ b/lib/crypto/sha1.myr
@@ -117,12 +117,12 @@ impl hash sha1 =
r[9] = (st.c >> 16 : byte)
r[10] = (st.c >> 8 : byte)
r[11] = (st.c >> 0 : byte)
- r[12] = (st.d >> 16 : byte)
- r[13] = (st.d >> 24 : byte)
+ r[12] = (st.d >> 24 : byte)
+ r[13] = (st.d >> 16 : byte)
r[14] = (st.d >> 8 : byte)
r[15] = (st.d >> 0 : byte)
- r[16] = (st.e >> 16 : byte)
- r[17] = (st.e >> 24 : byte)
+ r[16] = (st.e >> 24 : byte)
+ r[17] = (st.e >> 16 : byte)
r[18] = (st.e >> 8 : byte)
r[19] = (st.e >> 0 : byte)
}
diff --git a/lib/crypto/test/sha1.myr b/lib/crypto/test/sha1.myr
index 0cd3bd8..330d838 100644
--- a/lib/crypto/test/sha1.myr
+++ b/lib/crypto/test/sha1.myr
@@ -3,15 +3,15 @@ use crypto
const main = {
hasheq(crypto.sha1("")[:], \
- "da39a3ee5e6b4b0d3255bfef60951890d8af0709")
+ "da39a3ee5e6b4b0d3255bfef95601890afd80709")
hasheq(crypto.sha1("h")[:], \
- "27d5482eebd075de44389774e2fc8c695cf48a75")
+ "27d5482eebd075de44389774fce28c69f45c8a75")
/* 64 byte block */
hasheq(crypto.sha1("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")[:], \
- "0098ba824b5c16427bd7a1125a2a442aec25644d")
+ "0098ba824b5c16427bd7a1122a5a442a25ec644d")
/* tail spanning */
hasheq(crypto.sha1("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbb")[:], \
- "4eb17e52bb55910b037869438f69d9c87643d75a")
+ "4eb17e52bb55910b03786943698fd9c84376d75a")
}
const hasheq = {got, expected