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$
1
  • $\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
    Commented Jun 9, 2020 at 2:05

1 Answer 1

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.