libhasha 2.2.2
Loading...
Searching...
No Matches
sha2.h
Go to the documentation of this file.
1
22
23#if !defined(__HASHA_SHA2_H)
24#define __HASHA_SHA2_H
25
26/* dangerous */
27#ifdef HA_SHA2_ALIAS_MAP
28#define sha224 sha2_256
29#define sha256 sha2_256
30#define sha384 sha2_384
31#define sha512 sha2_512
32#endif
33
34#include "internal/internal.h"
35/* #include "sha2_k.h" */ /* not used in header */
36
42#define HA_SHA2_224_BLOCK_SIZE 64
43
49#define HA_SHA2_224_DIGEST_SIZE ha_bB(224)
50
56#define HA_SHA2_256_BLOCK_SIZE 64
57
63#define HA_SHA2_256_DIGEST_SIZE ha_bB(256)
64
70#define HA_SHA2_384_BLOCK_SIZE 128
71
77#define HA_SHA2_384_DIGEST_SIZE ha_bB(384)
78
84#define HA_SHA2_512_BLOCK_SIZE 128
85
91#define HA_SHA2_512_DIGEST_SIZE ha_bB(512)
92
98#define HA_SHA2_512_224_BLOCK_SIZE 128
99
105#define HA_SHA2_512_224_DIGEST_SIZE ha_bB(224)
106
112#define HA_SHA2_512_256_BLOCK_SIZE 128
113
119#define HA_SHA2_512_256_DIGEST_SIZE ha_bB(256)
120
122
138
154
170
186
203
220
232 ha_inbuf_t data);
233
243
255 ha_inbuf_t data, size_t length);
256
269 ha_digest_t digest);
270
283HA_PUBFUN void ha_sha2_224_hash(ha_inbuf_t data, size_t length,
284 ha_digest_t digest);
285
297 ha_inbuf_t data);
298
308
320 ha_inbuf_t data, size_t length);
321
334 ha_digest_t digest);
335
348HA_PUBFUN void ha_sha2_256_hash(ha_inbuf_t data, size_t length,
349 ha_digest_t digest);
350
362 ha_inbuf_t data);
363
373
385 ha_inbuf_t data, size_t length);
386
399 ha_digest_t digest);
400
413HA_PUBFUN void ha_sha2_384_hash(ha_inbuf_t data, size_t length,
414 ha_digest_t digest);
415
427 ha_inbuf_t data);
428
438
450 ha_inbuf_t data, size_t length);
451
464 ha_digest_t digest);
465
478HA_PUBFUN void ha_sha2_512_hash(ha_inbuf_t data, size_t length,
479 ha_digest_t digest);
480
492 ha_inbuf_t data);
493
504
516 ha_inbuf_t data, size_t length);
517
530 ha_digest_t digest);
531
545 ha_digest_t digest);
546
558 ha_inbuf_t data);
559
570
582 ha_inbuf_t data, size_t length);
583
596 ha_digest_t digest);
597
611 ha_digest_t digest);
612
614
615#endif // __HASHA_SHA2_H
#define HA_PUBFUN
Definition hadefs.h:34
#define HA_EXTERN_C_END
Definition hadefs.h:78
#define HA_EXTERN_C_BEG
Definition hadefs.h:70
HA_PUBFUN void ha_sha2_224_hash(ha_inbuf_t data, size_t length, ha_digest_t digest)
Computes the SHA-2 224-bit hash in a one-shot operation.
HA_PUBFUN void ha_sha2_256_final(ha_sha2_256_context *ctx, ha_digest_t digest)
Finalizes the SHA-2 256-bit computation and produces the hash digest.
HA_PUBFUN void ha_sha2_256_transform(ha_sha2_256_context *ctx, ha_inbuf_t data)
Transforms the data in the SHA-2 256-bit context.
HA_PUBFUN void ha_sha2_384_hash(ha_inbuf_t data, size_t length, ha_digest_t digest)
Computes the SHA-2 384-bit hash in a one-shot operation.
HA_PUBFUN void ha_sha2_512_224_update(ha_sha2_512_224_context *ctx, ha_inbuf_t data, size_t length)
Updates the SHA-2 512-224-bit context with new data.
HA_PUBFUN void ha_sha2_512_256_hash(ha_inbuf_t data, size_t length, ha_digest_t digest)
Computes the SHA-2 512-256-bit hash in a one-shot operation.
HA_PUBFUN void ha_sha2_512_256_transform(ha_sha2_512_256_context *ctx, ha_inbuf_t data)
Transforms the data in the SHA-2 512-256-bit context.
HA_PUBFUN void ha_sha2_512_transform(ha_sha2_512_context *ctx, ha_inbuf_t data)
Transforms the data in the SHA-2 512-bit context.
HA_PUBFUN void ha_sha2_512_final(ha_sha2_512_context *ctx, ha_digest_t digest)
Finalizes the SHA-2 512-bit computation and produces the hash digest.
HA_PUBFUN void ha_sha2_512_256_final(ha_sha2_512_256_context *ctx, ha_digest_t digest)
Finalizes the SHA-2 512-256-bit computation and produces the hash digest.
#define HA_SHA2_512_256_BLOCK_SIZE
The block size in bytes for the SHA-2 512-256 algorithm (128 bytes).
Definition sha2.h:112
HA_PUBFUN void ha_sha2_512_224_hash(ha_inbuf_t data, size_t length, ha_digest_t digest)
Computes the SHA-2 512-224-bit hash in a one-shot operation.
HA_PUBFUN void ha_sha2_224_final(ha_sha2_224_context *ctx, ha_digest_t digest)
Finalizes the SHA-2 224-bit computation and produces the hash digest.
HA_PUBFUN void ha_sha2_224_init(ha_sha2_224_context *ctx)
Initializes the SHA-2 224-bit context.
#define HA_SHA2_384_BLOCK_SIZE
The block size in bytes for the SHA-2 384-bit algorithm (128 bytes).
Definition sha2.h:70
HA_PUBFUN void ha_sha2_512_224_final(ha_sha2_512_224_context *ctx, ha_digest_t digest)
Finalizes the SHA-2 512-224-bit computation and produces the hash digest.
HA_PUBFUN void ha_sha2_256_init(ha_sha2_256_context *ctx)
Initializes the SHA-2 256-bit context.
HA_PUBFUN void ha_sha2_512_256_init(ha_sha2_512_256_context *ctx)
Initializes the SHA-2 512-256-bit context.
HA_PUBFUN void ha_sha2_512_hash(ha_inbuf_t data, size_t length, ha_digest_t digest)
Computes the SHA-2 512-bit hash in a one-shot operation.
HA_PUBFUN void ha_sha2_224_update(ha_sha2_224_context *ctx, ha_inbuf_t data, size_t length)
Updates the SHA-2 224-bit context with new data.
HA_PUBFUN void ha_sha2_384_init(ha_sha2_384_context *ctx)
Initializes the SHA-2 384-bit context.
HA_PUBFUN void ha_sha2_224_transform(ha_sha2_224_context *ctx, ha_inbuf_t data)
Transforms the data in the SHA-2 224-bit context.
HA_PUBFUN void ha_sha2_384_update(ha_sha2_384_context *ctx, ha_inbuf_t data, size_t length)
Updates the SHA-2 384-bit context with new data.
#define HA_SHA2_224_BLOCK_SIZE
The block size in bytes for the SHA-2 224-bit algorithm (64 bytes).
Definition sha2.h:42
HA_PUBFUN void ha_sha2_512_224_transform(ha_sha2_512_224_context *ctx, ha_inbuf_t data)
Transforms the data in the SHA-2 512-224-bit context.
HA_PUBFUN void ha_sha2_512_init(ha_sha2_512_context *ctx)
Initializes the SHA-2 512-bit context.
#define HA_SHA2_512_224_BLOCK_SIZE
The block size in bytes for the SHA-2 512-224 algorithm (128 bytes).
Definition sha2.h:98
HA_PUBFUN void ha_sha2_512_update(ha_sha2_512_context *ctx, ha_inbuf_t data, size_t length)
Updates the SHA-2 512-bit context with new data.
HA_PUBFUN void ha_sha2_384_transform(ha_sha2_384_context *ctx, ha_inbuf_t data)
Transforms the data in the SHA-2 384-bit context.
HA_PUBFUN void ha_sha2_384_final(ha_sha2_384_context *ctx, ha_digest_t digest)
Finalizes the SHA-2 384-bit computation and produces the hash digest.
#define HA_SHA2_512_BLOCK_SIZE
The block size in bytes for the SHA-2 512-bit algorithm (128 bytes).
Definition sha2.h:84
#define HA_SHA2_256_BLOCK_SIZE
The block size in bytes for the SHA-2 256-bit algorithm (64 bytes).
Definition sha2.h:56
HA_PUBFUN void ha_sha2_256_update(ha_sha2_256_context *ctx, ha_inbuf_t data, size_t length)
Updates the SHA-2 256-bit context with new data.
HA_PUBFUN void ha_sha2_256_hash(ha_inbuf_t data, size_t length, ha_digest_t digest)
Computes the SHA-2 256-bit hash in a one-shot operation.
HA_PUBFUN void ha_sha2_512_256_update(ha_sha2_512_256_context *ctx, ha_inbuf_t data, size_t length)
Updates the SHA-2 512-256-bit context with new data.
HA_PUBFUN void ha_sha2_512_224_init(ha_sha2_512_224_context *ctx)
Initializes the SHA-2 512-224-bit context.
Context structure for SHA-2 224-bit hashing.
Definition sha2.h:131
uint32_t state[8]
Definition sha2.h:132
uint8_t buffer[HA_SHA2_224_BLOCK_SIZE]
Definition sha2.h:135
uint64_t bit_count
Definition sha2.h:134
Context structure for SHA-2 256-bit hashing.
Definition sha2.h:147
uint8_t buffer[HA_SHA2_256_BLOCK_SIZE]
Definition sha2.h:151
uint32_t state[8]
Definition sha2.h:148
uint64_t bit_count
Definition sha2.h:150
Context structure for SHA-2 384-bit hashing.
Definition sha2.h:163
uint64_t bit_count[2]
Definition sha2.h:165
uint8_t buffer[HA_SHA2_384_BLOCK_SIZE]
Definition sha2.h:167
uint64_t state[8]
Definition sha2.h:164
Context structure for SHA-2 512-224-bit hashing.
Definition sha2.h:195
uint64_t state[8]
Definition sha2.h:196
uint8_t buffer[HA_SHA2_512_224_BLOCK_SIZE]
Definition sha2.h:200
Context structure for SHA-2 512-256-bit hashing.
Definition sha2.h:212
uint64_t state[8]
Definition sha2.h:213
uint8_t buffer[HA_SHA2_512_256_BLOCK_SIZE]
Definition sha2.h:217
Context structure for SHA-2 512-bit hashing.
Definition sha2.h:179
uint64_t bit_count
Definition sha2.h:182
uint8_t buffer[HA_SHA2_512_BLOCK_SIZE]
Definition sha2.h:183
uint64_t state[8]
Definition sha2.h:180
__ha_out_buf_type ha_digest_t
Definition types.h:15
__ha_in_buf_type ha_inbuf_t
Definition types.h:12