ref: f6eb57283f625cbd20d5bb423331e88ddc82c8f1
parent: 100d3a203f8ee81adc5e31adac2d2c6c0ce65e5f
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Oct 3 05:58:56 EDT 2018
Unswap sha output bytes. (Thanks Mike!)
--- a/lib/crypto/sha1.myr
+++ b/lib/crypto/sha1.myr
@@ -117,12 +117,12 @@
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)
}
--- a/lib/crypto/test/sha1.myr
+++ b/lib/crypto/test/sha1.myr
@@ -3,15 +3,15 @@
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