summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Turek <brian.turek@gmail.com>2013-12-15 07:29:22 -0500
committerBrian Turek <brian.turek@gmail.com>2013-12-15 07:29:22 -0500
commit734dab81b1238263b9ed2d69fa1a8b6d7567fffd (patch)
tree7caef489199f06a5c4d4e89e951b5e1ae66b4f49
parent3021ef584ac117c424af824ca7cbfc6b058fae4f (diff)
downloadjsSHA-734dab81b1238263b9ed2d69fa1a8b6d7567fffd.zip
jsSHA-734dab81b1238263b9ed2d69fa1a8b6d7567fffd.tar.gz
jsSHA-734dab81b1238263b9ed2d69fa1a8b6d7567fffd.tar.bz2
Removed constant K array from SHA-1
-rwxr-xr-xsrc/sha_dev.js30
1 files changed, 4 insertions, 26 deletions
diff --git a/src/sha_dev.js b/src/sha_dev.js
index 27cb8cc..2c519f7 100755
--- a/src/sha_dev.js
+++ b/src/sha_dev.js
@@ -742,28 +742,6 @@ var SUPPORTED_ALGS = 4 | 2 | 1;
safeAdd_5 = safeAdd_32_5, appendedMessageLength,
H = [
0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0
- ],
- K = [
- 0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999,
- 0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999,
- 0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999,
- 0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999,
- 0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999,
- 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1,
- 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1,
- 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1,
- 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1,
- 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1,
- 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc,
- 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc,
- 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc,
- 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc,
- 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc,
- 0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6,
- 0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6,
- 0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6,
- 0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6,
- 0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6
];
/* Append '1' at the end of the binary string */
@@ -796,17 +774,17 @@ var SUPPORTED_ALGS = 4 | 2 | 1;
if (t < 20)
{
- T = safeAdd_5(rotl(a, 5), ch(b, c, d), e, K[t], W[t]);
+ T = safeAdd_5(rotl(a, 5), ch(b, c, d), e, 0x5a827999, W[t]);
}
else if (t < 40)
{
- T = safeAdd_5(rotl(a, 5), parity(b, c, d), e, K[t], W[t]);
+ T = safeAdd_5(rotl(a, 5), parity(b, c, d), e, 0x6ed9eba1, W[t]);
}
else if (t < 60)
{
- T = safeAdd_5(rotl(a, 5), maj(b, c, d), e, K[t], W[t]);
+ T = safeAdd_5(rotl(a, 5), maj(b, c, d), e, 0x8f1bbcdc, W[t]);
} else {
- T = safeAdd_5(rotl(a, 5), parity(b, c, d), e, K[t], W[t]);
+ T = safeAdd_5(rotl(a, 5), parity(b, c, d), e, 0xca62c1d6, W[t]);
}
e = d;