sha1

string

Generates a SHA-1 cryptographic hash of a string

Syntax

sha1(string)

Parameters

string (string)

The string to hash

Returns

string

SHA-1 hash as hexadecimal string

Examples

Input:
sha1("password")
Output:
"5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8"
Input:
sha1("hello")
Output:
"aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d"
Input:
"test" | sha1
Output:
"a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"

The sha1() function generates a SHA-1 cryptographic hash of a string. SHA-1 produces a 160-bit (40 hexadecimal character) hash.

Usage

Use sha1() for legacy compatibility, git commit hashing, or checksums. Note: SHA-1 is considered cryptographically broken for security purposes; use SHA-256 or SHA-512 for new applications.

Related Functions