Pranjal Mishra
Pranjal Mishra

Reputation: 9

Any way to get orginal data from hashed values in snowflake?

I have a table which uses the snowflake hash function to store values in some columns. Is there any way to reverse the encrytion from the hash function and get the original values from the table?

As per the documentation, the function is not "not a cryptographic hash function", and will always return the same result for the same input expression. Example :

select hash(1) always returns -4730168494964875235

select hash('a') always returns -947125324004678632

select hash('1234') always returns -4035663806895772878

I was wondering if there is any way to reverse the hashing and get the original input expression from the hashed values.

Upvotes: 0

Views: 1094

Answers (1)

Gokhan Atil
Gokhan Atil

Reputation: 10109

I think these disclaimers are for preventing potential legal disputes:

Cryptographic hash functions have a few properties which this function does not, for example:

The cryptographic hashing of a value cannot be inverted to find the original value.

It's not possible to reserve a hash value in general. If you consider that when you even send a very long text, and it is represented in a 64-bit value, it's obvious that the data is not preserved. On the other hand, if you use a brute force technique, you may find the actual value producing the hash, and it can be counted as reserving the hash value.

For example, if you store all hash values for the numbers between 0 and 5000 in a table, when I came with hash value '-7875472545445966613', you can look up that value in your table, and say it belongs to 1000 (number).

Upvotes: 1

Related Questions