#define SHA384_HASHSZ 48
#define SHA384_STATESZ 64
+#define SHA512_256_BUFSZ 128
+#define SHA512_256_HASHSZ 32
+#define SHA512_256_STATESZ 64
+
+#define SHA512_224_BUFSZ 128
+#define SHA512_224_HASHSZ 28
+#define SHA512_224_STATESZ 64
+
/*----- Data structures ---------------------------------------------------*/
typedef struct sha512_ctx {
uint32 nh, nl; /* Byte count so far */
unsigned off; /* Offset into buffer */
octet buf[SHA512_BUFSZ]; /* Accumulation buffer */
-} sha512_ctx, sha384_ctx;
+} sha512_ctx, sha384_ctx, sha512_256_ctx, sha512_224_ctx;
/*----- Functions provided ------------------------------------------------*/
-/* --- @sha512_compress@, @sha384_compress@ --- *
+/* --- @sha512_compress@, etc. --- *
*
* Arguments: @sha512_ctx *ctx@ = pointer to context block
* @const void *sbuf@ = pointer to buffer of appropriate size
extern void sha512_compress(sha512_ctx */*ctx*/, const void */*sbuf*/);
#define sha384_compress sha512_compress
+#define sha512_256_compress sha512_compress
+#define sha512_224_compress sha512_compress
-/* --- @sha512_init@, @sha384_init@ --- *
+/* --- @sha512_init@, etc. --- *
*
* Arguments: @sha512_ctx *ctx@ = pointer to context block to initialize
*
extern void sha512_init(sha512_ctx */*ctx*/);
extern void sha384_init(sha512_ctx */*ctx*/);
+extern void sha512_256_init(sha512_ctx */*ctx*/);
+extern void sha512_224_init(sha512_ctx */*ctx*/);
-/* --- @sha512_set@, @sha384_set@ --- *
+/* --- @sha512_set@, etc. --- *
*
* Arguments: @sha512_ctx *ctx@ = pointer to context block
* @const void *buf@ = pointer to state buffer
extern void sha512_set(sha512_ctx */*ctx*/, const void */*buf*/,
unsigned long /*count*/);
#define sha384_set sha512_set
+#define sha512_256_set sha512_set
+#define sha512_224_set sha512_set
-/* --- @sha512_hash@, @sha384_hash@ --- *
+/* --- @sha512_hash@, etc. --- *
*
* Arguments: @sha512_ctx *ctx@ = pointer to context block
* @const void *buf@ = buffer of data to hash
extern void sha512_hash(sha512_ctx */*ctx*/,
const void */*buf*/, size_t /*sz*/);
#define sha384_hash sha512_hash
+#define sha512_256_hash sha512_hash
+#define sha512_224_hash sha512_hash
-/* --- @sha512_done@, @sha384_done@ --- *
+/* --- @sha512_done@, etc. --- *
*
* Arguments: @sha512_ctx *ctx@ = pointer to context block
* @void *hash@ = pointer to output buffer
extern void sha512_done(sha512_ctx */*ctx*/, void */*hash*/);
extern void sha384_done(sha512_ctx */*ctx*/, void */*hash*/);
+extern void sha512_256_done(sha512_ctx */*ctx*/, void */*hash*/);
+extern void sha512_224_done(sha512_ctx */*ctx*/, void */*hash*/);
/* --- @sha512_state@, @sha384_state@ --- *
*
extern unsigned long sha512_state(sha512_ctx */*ctx*/, void */*state*/);
#define sha384_state sha512_state
+#define sha512_256_state sha512_state
+#define sha512_224_state sha512_state
/*----- Generic hash interface --------------------------------------------*/
extern const gchash sha512;
extern const gchash sha384;
+extern const gchash sha512_256;
+extern const gchash sha512_224;
/*----- That's all, folks -------------------------------------------------*/