summaryrefslogtreecommitdiff
path: root/lib/sha.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-09-17 11:11:01 +0000
committerJim Meyering <jim@meyering.net>2000-09-17 11:11:01 +0000
commit30ee9b30061a6e65ee0a4f80d413cf87e1adb13c (patch)
tree2f398c325aecf9eeef617ff0a22027b13ff3a84c /lib/sha.c
parente87dcda4802dc681f9a972f40a1dff88c239d336 (diff)
downloadcoreutils-30ee9b30061a6e65ee0a4f80d413cf87e1adb13c.tar.xz
moving to gnupg's version of sha1.c
Diffstat (limited to 'lib/sha.c')
-rw-r--r--lib/sha.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/sha.c b/lib/sha.c
index 8fe8d61b5..6f4c5c2c5 100644
--- a/lib/sha.c
+++ b/lib/sha.c
@@ -234,10 +234,10 @@ sha_process_bytes (const void *buffer, size_t len, struct sha_ctx *ctx)
#define K3 0x8f1bbcdcL
#define K4 0xca62c1d6L
-/* Round functions. Note that f2() is used in both rounds 2 and 4 */
-#define f1(B,C,D) ( D ^ ( B & ( C ^ D ) ) )
-#define f2(B,C,D) (B ^ C ^ D)
-#define f3(B,C,D) ( ( B & C ) | ( D & ( B | C ) ) )
+/* Round functions. Note that F2() is used in both rounds 2 and 4 */
+#define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) )
+#define F2(B,C,D) (B ^ C ^ D)
+#define F3(B,C,D) ( ( B & C ) | ( D & ( B | C ) ) )
#if SHA_DEBUG
char bin2hex[16]={'0','1','2','3','4','5','6','7',
@@ -294,7 +294,7 @@ sha_process_block (const void *buffer, size_t len, struct sha_ctx *ctx)
the correct round function and constant */
for (t = 0; t < 20; t++)
{
- md5_uint32 tmp = rol (A, 5) + f1 (B, C, D) + E + W[t] + K1;
+ md5_uint32 tmp = rol (A, 5) + F1 (B, C, D) + E + W[t] + K1;
E = D;
D = C;
C = rol (B, 30);
@@ -303,7 +303,7 @@ sha_process_block (const void *buffer, size_t len, struct sha_ctx *ctx)
}
for (; t < 40; t++)
{
- md5_uint32 tmp = rol (A, 5) + f2 (B, C, D) + E + W[t] + K2;
+ md5_uint32 tmp = rol (A, 5) + F2 (B, C, D) + E + W[t] + K2;
E = D;
D = C;
C = rol (B, 30);
@@ -312,7 +312,7 @@ sha_process_block (const void *buffer, size_t len, struct sha_ctx *ctx)
}
for (; t < 60; t++)
{
- md5_uint32 tmp = rol (A, 5) + f3 (B, C, D) + E + W[t] + K3;
+ md5_uint32 tmp = rol (A, 5) + F3 (B, C, D) + E + W[t] + K3;
E = D;
D = C;
C = rol (B, 30);
@@ -321,7 +321,7 @@ sha_process_block (const void *buffer, size_t len, struct sha_ctx *ctx)
}
for (; t < 80; t++)
{
- md5_uint32 tmp = rol (A, 5) + f2 (B, C, D) + E + W[t] + K4;
+ md5_uint32 tmp = rol (A, 5) + F2 (B, C, D) + E + W[t] + K4;
E = D;
D = C;
C = rol (B, 30);