Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Utilities/cmlibrhash/librhash/sha512.h
3150 views
1
/* sha.h sha512 and sha384 hash functions */
2
#ifndef SHA512_H
3
#define SHA512_H
4
#include "ustd.h"
5
6
#ifdef __cplusplus
7
extern "C" {
8
#endif
9
10
#define sha512_block_size 128
11
#define sha512_hash_size 64
12
#define sha384_hash_size 48
13
14
/* algorithm context */
15
typedef struct sha512_ctx
16
{
17
uint64_t message[16]; /* 1024-bit buffer for leftovers */
18
uint64_t length; /* number of processed bytes */
19
uint64_t hash[8]; /* 512-bit algorithm internal hashing state */
20
unsigned digest_length; /* length of the algorithm digest in bytes */
21
} sha512_ctx;
22
23
void rhash_sha384_init(sha512_ctx* ctx);
24
void rhash_sha512_init(sha512_ctx* ctx);
25
void rhash_sha512_update(sha512_ctx* ctx, const unsigned char* data, size_t length);
26
void rhash_sha512_final(sha512_ctx* ctx, unsigned char* result);
27
28
#ifdef __cplusplus
29
} /* extern "C" */
30
#endif /* __cplusplus */
31
32
#endif /* SHA512_H */
33
34