cubehash.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* cubehash.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 CUBEHASH_H_
  17. #define CUBEHASH_H_
  18. #include <stdint.h>
  19. #define CUBEHASH224_BLOCKSIZE 256
  20. #define CUBEHASH224_BLOCKSIZE_B ((CUBEHASH224_BLOCKSIZE+7)/8)
  21. #define CUBEHASH256_BLOCKSIZE 256
  22. #define CUBEHASH256_BLOCKSIZE_B ((CUBEHASH256_BLOCKSIZE+7)/8)
  23. #define CUBEHASH384_BLOCKSIZE 256
  24. #define CUBEHASH384_BLOCKSIZE_B ((CUBEHASH284_BLOCKSIZE+7)/8)
  25. #define CUBEHASH512_BLOCKSIZE 256
  26. #define CUBEHASH512_BLOCKSIZE_B ((CUBEHASH512_BLOCKSIZE+7)/8)
  27. typedef struct {
  28. uint32_t a[32];
  29. uint8_t rounds;
  30. uint8_t blocksize_B;
  31. } cubehash_ctx_t;
  32. void cubehash_init(uint8_t r, uint8_t b, uint16_t h, cubehash_ctx_t* ctx);
  33. void cubehash_nextBlock(cubehash_ctx_t* ctx, void* block);
  34. void cubehash_lastBlock(cubehash_ctx_t* ctx, void* block, uint16_t length_b);
  35. void cubehash_ctx2hash(void* dest, uint16_t length_b, cubehash_ctx_t* ctx);
  36. void cubehash224_init(cubehash_ctx_t* ctx);
  37. void cubehash224_ctx2hash(void* dest, cubehash_ctx_t* ctx);
  38. void cubehash256_init(cubehash_ctx_t* ctx);
  39. void cubehash256_ctx2hash(void* dest, cubehash_ctx_t* ctx);
  40. void cubehash384_init(cubehash_ctx_t* ctx);
  41. void cubehash384_ctx2hash(void* dest, cubehash_ctx_t* ctx);
  42. void cubehash512_init(cubehash_ctx_t* ctx);
  43. void cubehash512_ctx2hash(void* dest, cubehash_ctx_t* ctx);
  44. #endif /* CUBEHASH_H_ */