Skip to content

Instantly share code, notes, and snippets.

@krisnova
Last active May 26, 2021 05:45
Show Gist options
  • Save krisnova/b0ba2c3ef0310bd30a899dcde9cf54f0 to your computer and use it in GitHub Desktop.
Save krisnova/b0ba2c3ef0310bd30a899dcde9cf54f0 to your computer and use it in GitHub Desktop.

Given an input

n = "This is a wonderful thing I would LOVE to have a deterministic hash of (somewhat quickly)"

And SOME hashing function.

In this case I just picked sha256 for the reasonable "small" ammount of possible outcomes.

f = sha256sum

I can generate a hash sum that adheres to all the fun hashing tenants: wiki

f(n) = "6c00b0a8465f0f0491ab9d5380c0a44f801f26d4222e5a1177d6ad92a672b434"

The Question(s)

Knowning that with sha256 there are 2^256 possible combinations, would it be possible to translate the hash into some other unique string taken from a set of items that also yielded 2^256 possible combinations.

Does this exist? Does this pattern have a name? Are there other functions that do this? Are there functions that would be better than sha256 for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment