sha512.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef _SHA512_H
  2. #define _SHA512_H
  3. #define SHA384_SUM_LEN 48
  4. #define SHA384_DER_LEN 19
  5. #define SHA512_SUM_LEN 64
  6. #define SHA512_DER_LEN 19
  7. #define SHA512_BLOCK_SIZE 128
  8. #define CHUNKSZ_SHA384 (16 * 1024)
  9. #define CHUNKSZ_SHA512 (16 * 1024)
  10. typedef struct {
  11. uint64_t state[SHA512_SUM_LEN / 8];
  12. uint64_t count[2];
  13. uint8_t buf[SHA512_BLOCK_SIZE];
  14. } sha512_context;
  15. extern const uint8_t sha512_der_prefix[];
  16. void sha512_starts(sha512_context * ctx);
  17. void sha512_update(sha512_context *ctx, const uint8_t *input, uint32_t length);
  18. void sha512_finish(sha512_context * ctx, uint8_t digest[SHA512_SUM_LEN]);
  19. void sha512_csum_wd(const unsigned char *input, unsigned int ilen,
  20. unsigned char *output, unsigned int chunk_sz);
  21. extern const uint8_t sha384_der_prefix[];
  22. void sha384_starts(sha512_context * ctx);
  23. void sha384_update(sha512_context *ctx, const uint8_t *input, uint32_t length);
  24. void sha384_finish(sha512_context * ctx, uint8_t digest[SHA384_SUM_LEN]);
  25. void sha384_csum_wd(const unsigned char *input, unsigned int ilen,
  26. unsigned char *output, unsigned int chunk_sz);
  27. #endif /* _SHA512_H */