snowflake.snowpark.functions.sha2¶

snowflake.snowpark.functions.sha2(e: Union[Column, str], num_bits: int) → Column[source]¶

Returns a hex-encoded string containing the N-bit SHA-2 message digest, where N is the specified output digest size.

Example::
>>> df = session.create_dataframe(["a", "b"], schema=["col"]).select(sha2("col", 256))
>>> df.collect()
[Row(SHA2("COL", 256)='ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb'), Row(SHA2("COL", 256)='3e23e8160039594a33894f6564e1b1348bbd7a0088d42c4acb73eeaed59c009d')]
Copy