Score:1

Is it insecure to use a hash function to map (potentially critical) inputs to the same length?

us flag
hex

Say I have two values $x$ and $y$ of slightly different lengths. They can be passwords or keys or any other critical value, and I want to deterministically map them to two values of the same length.

Would using a secure hash function to achieve that purpose introduce any weakness into the system? We can assume the the output length of the hash function is not too small compared to the original inputs (e.g. the original inputs are not files worth MBs but simple strings of at most a few hundred bits).

Additionally, how does this compare to simply padding one of the inputs with zeros?

kelalaka avatar
in flag
Welcome to cryptography.SE. What is the system, what are the risks on the system?What is the entropy of the inputs? How they are generated, is there a relation between them? If we only consider the pre-image resistance of the Hash function to your title question then use SHA-512, SHA3-512 etc. However, what is the input space? Short input space can be problematic for hashing and what is the output size that you want to use from hash function....
fgrieu avatar
ng flag
For a wide-enough (32 bytes or more) cryptographic and unbroken hash, I don't see that replacing inputs by their hash can worsen a system. But the problem is under-specified, because "critical input" does not tell what's critical in the inputs: secrecy? that they are not altered? not replayed? that they come from an identified source?
kelalaka avatar
in flag
[This is the problem with short inputs](https://crypto.stackexchange.com/a/81652/18298) for the security of the hash functions (pre-image).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.