ed25519_hash_custom_sha3.h 780 B

1234567891011121314151617181920212223
  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. #ifndef ED25519_HASH_CUSTOM
  10. #define ED25519_HASH_CUSTOM
  11. #include "../sha3.h"
  12. #define ed25519_hash_context SHA3_CTX
  13. #define ed25519_hash_init(ctx) sha3_512_Init(ctx)
  14. #define ed25519_hash_update(ctx, in, inlen) sha3_Update((ctx), (in), (inlen))
  15. #define ed25519_hash_final(ctx, hash) sha3_Final((ctx), (hash))
  16. #define ed25519_hash(hash, in, inlen) sha3_512((in), (inlen), (hash))
  17. #endif // ED25519_HASH_CUSTOM