1
$\begingroup$

I'm looking at tweetnacl, its crypto_sign_keypair, crypto_sign, and crypto_sign_open functions modify and use the output of crypto_hash in various ways.

I would like to swap crypto_hash for another hash function with the same length output. While I would normally avoid doing something like this due to lack of knowledge, in this case it seems like it might be fine. The output of crypto_hash is presumably uniformly distributed, seemingly random, and so tweetnacl is surely not making any assumptions about the output of its hash function. If it's replaced by another function with the same length output, then I assume tweetnacl will use its output just as happily?

$\endgroup$
  • $\begingroup$ "The output of crypto_hash is presumably uniformly distributed, seemingly random, ...", and (to note that) its output is deterministically dependent on its input. $\endgroup$ – DannyNiu Jun 9 at 2:05
3
$\begingroup$

If it's replaced by another function with the same length output, then I assume tweetnacl will use its output just as happily?

Yes, it seems to be a normal collision-resistant cryptographic hash function, replacing it by any other will not significantly alter the security properties (unless one of them is broken) but will of course break interopability.

In fact if you could find a security-relevant difference between two secure hash functions (given only oracle-access) at least one of them would be broken.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.