SHA256Reset.c 1013 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*====================================================================*
  2. *
  3. * SHA256Reset (struct sha256 * sha256)
  4. *
  5. * SHA256.h
  6. *
  7. * initialize the SHA256 hash state; this effectively erases the
  8. * previous hash state;
  9. *
  10. * Read standard FIPS180-2 sec 5.3.2 for an explanation;
  11. *
  12. * Motley Tools by Charles Maier;
  13. * Copyright (c) 2001-2006 by Charles Maier Associates;
  14. * Licensed under the Internet Software Consortium License;
  15. *
  16. *--------------------------------------------------------------------*/
  17. #ifndef SHA256RESET_SOURCE
  18. #define SHA256RESET_SOURCE
  19. #include "../key/SHA256.h"
  20. void SHA256Reset (struct sha256 * sha256)
  21. {
  22. memset (sha256, 0, sizeof (struct sha256));
  23. sha256->state [0] = 0x6A09E667;
  24. sha256->state [1] = 0xBB67AE85;
  25. sha256->state [2] = 0x3C6EF372;
  26. sha256->state [3] = 0xA54FF53A;
  27. sha256->state [4] = 0x510E527F;
  28. sha256->state [5] = 0x9B05688C;
  29. sha256->state [6] = 0x1F83D9AB;
  30. sha256->state [7] = 0x5BE0CD19;
  31. sha256->extra [0] = 0x80;
  32. return;
  33. }
  34. #endif