ed25519_hash_custom_keccak.h 851 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. a custom hash must have a 512bit digest and implement:
  3. struct ed25519_hash_context;
  4. void ed25519_hash_init(ed25519_hash_context *ctx);
  5. void ed25519_hash_update(ed25519_hash_context *ctx, const uint8_t *in, size_t inlen);
  6. void ed25519_hash_final(ed25519_hash_context *ctx, uint8_t *hash);
  7. void ed25519_hash(uint8_t *hash, const uint8_t *in, size_t inlen);
  8. */
  9. #include "../options.h"
  10. #if USE_KECCAK
  11. #ifndef ED25519_HASH_CUSTOM
  12. #define ED25519_HASH_CUSTOM
  13. #include "../sha3.h"
  14. #define ed25519_hash_context SHA3_CTX
  15. #define ed25519_hash_init(ctx) keccak_512_Init(ctx)
  16. #define ed25519_hash_update(ctx, in, inlen) keccak_Update((ctx), (in), (inlen))
  17. #define ed25519_hash_final(ctx, hash) keccak_Final((ctx), (hash))
  18. #define ed25519_hash(hash, in, inlen) keccak_512((in), (inlen), (hash))
  19. #endif // ED25519_HASH_CUSTOM
  20. #endif // USE_KECCAK