sha256.h: correct definition on SHA224_DIGEST_SIZE
authorJim Meyering <meyering@redhat.com>
Thu, 31 Jul 2008 13:35:25 +0000 (15:35 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 31 Jul 2008 13:50:53 +0000 (15:50 +0200)
* lib/sha256.h (SHA224_DIGEST_SIZE): Define to 28, not 24.
Reported by Paulie Pena IV <paulie4@gmail.com>.
Define as 224 / 8, rather than as a literal.
(SHA256_DIGEST_SIZE): Define as 256/8 rather than equivalent literal.
* lib/sha512.h (SHA384_DIGEST_SIZE): Likewise, define as equiv: 384/8.
(SHA512_DIGEST_SIZE): Likewise, define as equivalent quotient: 512/8.

ChangeLog
lib/sha256.h
lib/sha512.h

index 792a1ef..e3d13f1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-07-31  Jim Meyering  <meyering@redhat.com>
+
+       sha256.h: correct definition of SHA224_DIGEST_SIZE
+       * lib/sha256.h (SHA224_DIGEST_SIZE): Define to 28, not 24.
+       Reported by Paulie Pena IV <paulie4@gmail.com>.
+       Define as 224 / 8, rather than as a literal.
+       (SHA256_DIGEST_SIZE): Define as 256/8 rather than equivalent literal.
+       * lib/sha512.h (SHA384_DIGEST_SIZE): Likewise, define as equiv: 384/8.
+       (SHA512_DIGEST_SIZE): Likewise, define as equivalent quotient: 512/8.
+
 2008-07-31  Bruno Haible  <bruno@clisp.org>
 
        * lib/regex_internal.h (BITSET_WORD_BITS): Make first conditional work
index 3aa1ce9..a63b201 100644 (file)
@@ -31,8 +31,8 @@ struct sha256_ctx
   uint32_t buffer[32];
 };
 
-enum { SHA224_DIGEST_SIZE = 24 };
-enum { SHA256_DIGEST_SIZE = 32 };
+enum { SHA224_DIGEST_SIZE = 224 / 8 };
+enum { SHA256_DIGEST_SIZE = 256 / 8 };
 
 /* Initialize structure containing state of computation. */
 extern void sha256_init_ctx (struct sha256_ctx *ctx);
index 84fe559..ed12d54 100644 (file)
@@ -32,8 +32,8 @@ struct sha512_ctx
   u64 buffer[32];
 };
 
-enum { SHA384_DIGEST_SIZE = 48 };
-enum { SHA512_DIGEST_SIZE = 64 };
+enum { SHA384_DIGEST_SIZE = 384 / 8 };
+enum { SHA512_DIGEST_SIZE = 512 / 8 };
 
 /* Initialize structure containing state of computation. */
 extern void sha512_init_ctx (struct sha512_ctx *ctx);