Need SQL Server HASHBYTES SHA1 output using Snowflake SHA1/standard SHA1 function
Solution 1:
You can use the following conversion to get the same result in Snowflake:
select to_char(to_binary(sha1('214163915155286001'), 'hex'), 'base64') as Result;
+------------------------------+
| RESULT |
+------------------------------+
| GRHT33lIRvvHTg5M8pEzRZRm4Oc= |
+------------------------------+
It's a kind of Magic :)
Solution 2:
Gokhan's answer is the howget the answer you say you want. But understanding what you have might help,
"1911d3df794846fbc74e0e4cf29133459466e0e7"
is the SHA1 hash, as presented as a string of the hash. Which you would use if you are doing a comparison of data SHA1 to check things are the "same and not changed" (to the limits of SHA1's ability to confirm this).
"GRHT33lIRvvHTg5M8pEzRZRm4Oc="
is a BASE64 encoded string. The normal giveaway is the equals on the end =
. But those are not always there as base64 encodes blocks of 3 x 2^8 (256) binary data as 4 x 2^6 (64) stream in the printable token range.