SHA256.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*====================================================================*
  2. *
  3. * SHA256.h - SHA256 encryption declarations and definitions;
  4. *
  5. * Motley Tools by Charles Maier;
  6. * Copyright (c) 2001-2006 by Charles Maier Associates;
  7. * Licensed under the Internet Software Consortium License;
  8. *
  9. *--------------------------------------------------------------------*/
  10. #ifndef SHA256_HEADER
  11. #define SHA256_HEADER
  12. /*====================================================================*
  13. * system header files;
  14. *--------------------------------------------------------------------*/
  15. #include <stdint.h>
  16. #include <string.h>
  17. /*====================================================================*
  18. * constants;
  19. *--------------------------------------------------------------------*/
  20. #define SHA256_DIGEST_LENGTH 256/8
  21. /*====================================================================*
  22. * variables;
  23. *--------------------------------------------------------------------*/
  24. typedef struct sha256
  25. {
  26. uint32_t count [2];
  27. uint32_t state [8];
  28. uint8_t block [64];
  29. uint8_t extra [64];
  30. }
  31. SHA256;
  32. /*====================================================================*
  33. * functions;
  34. *--------------------------------------------------------------------*/
  35. void SHA256Reset (struct sha256 * sha256);
  36. void SHA256Write (struct sha256 * sha256, void const * memory, size_t extent);
  37. void SHA256Block (struct sha256 * sha256, void const * memory);
  38. void SHA256Fetch (struct sha256 * sha256, uint8_t digest []);
  39. void SHA256Print (const uint8_t digest [], char const * string);
  40. void SHA256Ident (signed fd, uint8_t digest []);
  41. signed SHA256Match (signed fd, const uint8_t digest []);
  42. /*====================================================================*
  43. *
  44. *--------------------------------------------------------------------*/
  45. #endif