diff options
author | Jim Meyering <jim@meyering.net> | 2000-09-24 23:59:39 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2000-09-24 23:59:39 +0000 |
commit | ab367e6b1397ad91c2d31bc631a80314c6ecf0e7 (patch) | |
tree | 776070f53d3c930e2f7d638830bf73f8675c5a2a /lib/sha.c | |
parent | 8d0687974f1d0b17073b0178d49324ddac8b60ae (diff) | |
download | coreutils-ab367e6b1397ad91c2d31bc631a80314c6ecf0e7.tar.xz |
Give credit (GnuPG) where due.
(M): Use rol rather than open-coding it.
Add a FIXME comment.
Diffstat (limited to 'lib/sha.c')
-rw-r--r-- | lib/sha.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -241,7 +241,8 @@ sha_process_bytes (const void *buffer, size_t len, struct sha_ctx *ctx) #define F4(B,C,D) (B ^ C ^ D) /* Process LEN bytes of BUFFER, accumulating context into CTX. - It is assumed that LEN % 64 == 0. */ + It is assumed that LEN % 64 == 0. + Most of this code comes from GnuPG's cipher/sha1.c. */ void sha_process_block (const void *buffer, size_t len, struct sha_ctx *ctx) @@ -265,7 +266,7 @@ sha_process_block (const void *buffer, size_t len, struct sha_ctx *ctx) #define M(I) ( tm = x[I&0x0f] ^ x[(I-14)&0x0f] \ ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \ - , (x[I&0x0f] = (tm << 1) | (tm >> 31)) ) + , (x[I&0x0f] = rol(tm, 1)) ) #define R(A,B,C,D,E,F,K,M) do { E += rol( A, 5 ) \ + F( B, C, D ) \ @@ -278,6 +279,7 @@ sha_process_block (const void *buffer, size_t len, struct sha_ctx *ctx) { md5_uint32 tm; int t; + /* FIXME: see sha1.c for a better implementation. */ for (t = 0; t < 16; t++) { x[t] = NOTSWAP (*words); |