Subversion Repositories QNX 8.QNX8 IFS tool

Rev

Rev 16 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #ifndef SHA512_H
  2. #define SHA512_H
  3.  
  4.  
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8.  
  9.  
  10. // standard C includes
  11. #include <stdint.h>
  12.  
  13.  
  14. // SHA-512 block and digest sizes
  15. #define SHA512_BLOCK_LENGTH 128 // in bytes
  16. #define SHA512_DIGEST_LENGTH 64 // in bytes
  17.  
  18.  
  19. // SHA-512 computation context structure type definition
  20. typedef struct sha512_ctx_s
  21. {
  22.    uint64_t state[8];
  23.    uint64_t bitcount[2];
  24.    uint8_t buffer[SHA512_BLOCK_LENGTH];
  25. } SHA512_CTX;
  26.  
  27.  
  28. // prototypes of exported functions
  29. void SHA512_Init (SHA512_CTX *context);
  30. void SHA512_Update (SHA512_CTX *context, void *data, size_t len);
  31. void SHA512_Final (uint8_t digest[SHA512_DIGEST_LENGTH], SHA512_CTX *context);
  32. const char *SHA512 (void *data, size_t data_len, uint8_t *digest); // computes a SHA-512 in one pass (shortcut for SHA512_Init(), SHA512_Update() N times and SHA512_Final())
  33.  
  34.  
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38.  
  39.  
  40. #endif // SHA512_H
  41.