jh_simple.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* jh_simple.h */
  2. /*
  3. This file is part of the ARM-Crypto-Lib.
  4. Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef JH_SIMPLE_H_
  17. #define JH_SIMPLE_H_
  18. #include <stdint.h>
  19. #define JH224_BLOCKSIZE 512
  20. #define JH224_BLOCKSIZE_B ((JH224_BLOCKSIZE+7)/8)
  21. #define JH256_BLOCKSIZE 512
  22. #define JH256_BLOCKSIZE_B ((JH256_BLOCKSIZE+7)/8)
  23. #define JH384_BLOCKSIZE 512
  24. #define JH384_BLOCKSIZE_B ((JH284_BLOCKSIZE+7)/8)
  25. #define JH512_BLOCKSIZE 512
  26. #define JH512_BLOCKSIZE_B ((JH512_BLOCKSIZE+7)/8)
  27. typedef struct {
  28. uint8_t a[128];
  29. uint32_t block_hashed;
  30. } jh_ctx_t;
  31. void jh_init(uint16_t hashlen_b, jh_ctx_t* ctx);
  32. void jh_nextBlock(jh_ctx_t* ctx, void* block);
  33. void jh_lastBlock(jh_ctx_t* ctx, void* block, uint16_t length_b);
  34. void jh_ctx2hash(void* dest, uint16_t length_b, jh_ctx_t* ctx);
  35. void jh224_init(jh_ctx_t* ctx);
  36. void jh224_ctx2hash(void* dest, jh_ctx_t* ctx);
  37. void jh256_init(jh_ctx_t* ctx);
  38. void jh256_ctx2hash(void* dest, jh_ctx_t* ctx);
  39. void jh384_init(jh_ctx_t* ctx);
  40. void jh384_ctx2hash(void* dest, jh_ctx_t* ctx);
  41. void jh512_init(jh_ctx_t* ctx);
  42. void jh512_ctx2hash(void* dest, jh_ctx_t* ctx);
  43. #endif /* JH_SIMPLE_H_ */