The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.


Converts a string to a 160-bit hexadecimal SHA-1 hash.

The SHA1() function has two parameters:

  • stringToConvert (string): Required. The string to encode.
  • charSet (string): The character set to use for the encoding. The default value is UTF-8, but you can also use UTF-16 encoding.

To use this function, pass it a string.

The function outputs an SHA-1 hash of the provided string: 0af2f4853cc89dc1e1efe397ca334ce7a19d14da

You can also generate the hash using UTF-16 encoding, as in this example.

The function outputs an SHA-1 hash that uses UTF-16 encoding: 1a36453a2f2c1bf17dcc763321e5e35268e5e4c6