snowflake.snowpark.functions.md5_binary¶
- snowflake.snowpark.functions.md5_binary(msg: Union[snowflake.snowpark.column.Column, str]) Column[source]¶
Returns the MD5 hash of the input message as a binary value.
- Parameters:
msg (ColumnOrName) – The input message to compute the MD5 hash for.
- Returns:
The MD5 hash as a binary value (bytearray).
- Return type:
- Examples::
>>> from snowflake.snowpark import Row >>> from snowflake.snowpark.functions import col >>> df = session.create_dataframe([["Snowflake"], ["test"], [""]], schema=["msg"]) >>> result = df.select(md5_binary(col("msg")).alias("md5_result")).collect()
>>> expected = [ ... Row(MD5_RESULT=bytearray(b'\xed\xf1C\x90u\xa8:D\x7f\xb8\xb60\xdd\xc9\xc8\xde')), # "Snowflake" ... Row(MD5_RESULT=bytearray(b"\t\x8fk\xcdF!\xd3s\xca\xdeN\x83&'\xb4\xf6")), # "test" ... Row(MD5_RESULT=bytearray(b'\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04\xe9\x80\t\x98\xec\xf8B~')) # "" (empty) ... ]
>>> assert result == expected