Is it possible to securely generate two identical outputs based on one input, i.e. hashing that cannot be brute-forced
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
In cryptography and data security, the concept of generating identical outputs from a single input generally refers to deterministic processes such as hashing. Hash functions are mathematical algorithms that convert an input (or 'message') into a fixed-size string of bytes, typically a digest that appears random. Each unique input should, theoretically, produce a unique hash. However, the question here extends to whether it is possible to securely generate two identical outputs from one input in a manner impervious to brute-force attacks.
Understanding Hash Functions
Hash functions like SHA-256, used in blockchain technology and various security applications, are designed to be deterministic; the same message always results in the same hash and they are designed to be quick to compute. Two core properties related to the current discussion are:
- Collision Resistance: This means it should be difficult to find two different messages that produce the same hash.
- Pre-image Resistance: This means given a hash value, it should be difficult to find any message that hashes to that output.
The Concept of Generating Identical Outputs
Creating two identical outputs from a single input introduces nuances that seem contradictory at first. By definition, a cryptographic hash function will always produce the same output for the same input. However, producing two different outputs that can subsequently be resolved back to the same original output involves more complex cryptographic mechanisms such as encryption schemes or advanced data structures.
Encryption-Keyed Hash Functions
One way to achieve two identical yet secure outputs from one input is by using key-encrypted hash functions. Here, the procedure is as follows:
- Generate a unique hash for the input.
- Encrypt the hash using two different cryptographic keys.
For instance, suppose input produces hash , then:
- Encrypt with key to produce output
- Encrypt with key to produce output
Both and are derived from the same original input , and yet, without knowledge of and , a brute-force attack to deduce from either or or to confirm that both are derived from the same would be impractical.
Application Examples
This concept is practically used in situations where multifactor security is deployed. Assume a system wherein two different subsystems need to confirm an action without disclosing the input to each other. Using key-encrypted hashes, they can validate the action's integrity and authenticity by comparing outputs created from the same hashed input using their unique keys.
Security Considerations
Implementing such hash outputs securely requires careful consideration of the cryptographic primitives used:
- Key Management: Ensuring that the keys used for encryption (, ) are stored securely and are not susceptible to disclosure.
- Encryption Algorithm: The encryption algorithm needs to be robust enough to avoid vulnerabilities against cryptanalysis attacks.
- Hash Function: The hash function itself must be secure against known hash attack techniques such as collision and pre-image attacks.
Summary Table
| Feature | Description | Relevance to Secure Identical Outputs |
| Hash Function Properties | Collision and Pre-image Resistance | Ensures uniqueness and security |
| Key-Encrypted Hash Output | Outputs created using different encryption keys | Provides ability to generate secure, identical outputs |
| Application Example | Use in multifactor security systems | Demonstrates practical utility |
Overall, while generating two identical outputs from one input via traditional hashing is philosophically and technically contradictory, using advancements and combinations like key-based encryption of hashes can provide both the desired results and necessary security. This nuanced approach underscores the flexibility and depth of modern cryptographic practices.
Related reading
- Is it possible to set private property via reflection?
- is it safe to keep database connections open for long time
- Is there a unique Android device ID?
- Is there a way to create a token for a normal user in Kubernetes?
- Is there a way to get the source code from an APK file?
- Is there a way to get the source code from an APK file?
- Is there an S3 policy for limiting access to only see/access one bucket?
- Is there any code or algorithm for signature recognition?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.