pyspark.sql.functions.sha1

pyspark.sql.functions.sha1(col: ColumnOrName) → pyspark.sql.column.Column[source]

Returns the hex string result of SHA-1.

New in version 1.5.0.

Changed in version 3.4.0: Supports Spark Connect.

Parameters
colColumn or str

target column to compute on.

Returns
Column

the column for computed results.

Examples

>>> spark.createDataFrame([('ABC',)], ['a']).select(sha1('a').alias('hash')).collect()
[Row(hash='3c01bdbb26f358bab27f267924aa2c9a03fcfdb8')]