gosthash.h 890 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * gosthash.h
  3. * 21 Apr 1998 Markku-Juhani Saarinen <mjos@iki.fi>
  4. *
  5. * GOST R 34.11-94, Russian Standard Hash Function
  6. * header with function prototypes. ("API")
  7. */
  8. #ifndef GOSTHASH_H
  9. #define GOSTHASH_H
  10. #include <stdlib.h>
  11. /* State structure */
  12. typedef struct
  13. {
  14. unsigned long sum[8];
  15. unsigned long hash[8];
  16. unsigned long len[8];
  17. unsigned char partial[32];
  18. size_t partial_bytes;
  19. } GostHashCtx;
  20. /* Compute some lookup-tables that are needed by all other functions. */
  21. void gosthash_init();
  22. /* Clear the state of the given context structure. */
  23. void gosthash_reset(GostHashCtx *ctx);
  24. /* Mix in len bytes of data for the given buffer. */
  25. void gosthash_update(GostHashCtx *ctx, const unsigned char *buf, size_t len);
  26. /* Compute and save the 32-byte digest. */
  27. void gosthash_final(GostHashCtx *ctx, unsigned char *digest);
  28. #endif /* GOSTHASH_H */