匹配雪花 MD5 到 Python MD5
Match Snowflake MD5 to Python MD5
我正在尝试将 Snowflake md5_number_lower64
的 MD5 输出与 Python 中相同字符串的 MD5 输出相匹配。
完成此操作的代码是什么?
一个简单的例子(来自队友)来实现这一目标。在 Python:
import hashlib
def md5_number_lower64(msg):
return int.from_bytes(hashlib.md5(msg.encode('utf-8')).digest()[8:], 'big')
returns:
$ print(md5_number_lower64('Snowflake'))
> 9203306159527282910`
与 Snowflake 的结果匹配:
select md5_number_lower64('Snowflake');
-- 9203306159527282910
文档:
Returns a 64 bit unsigned integer that represents the lower 64 bits of the message digest. This representation is useful for maximally efficient storage and comparison of MD5 digests.
我正在尝试将 Snowflake md5_number_lower64
的 MD5 输出与 Python 中相同字符串的 MD5 输出相匹配。
完成此操作的代码是什么?
一个简单的例子(来自队友)来实现这一目标。在 Python:
import hashlib
def md5_number_lower64(msg):
return int.from_bytes(hashlib.md5(msg.encode('utf-8')).digest()[8:], 'big')
returns:
$ print(md5_number_lower64('Snowflake'))
> 9203306159527282910`
与 Snowflake 的结果匹配:
select md5_number_lower64('Snowflake');
-- 9203306159527282910
文档:
Returns a 64 bit unsigned integer that represents the lower 64 bits of the message digest. This representation is useful for maximally efficient storage and comparison of MD5 digests.