PPL cryptographic hash functions - Amazon OpenSearch Service

PPL cryptographic hash functions

Note

To see which AWS data source integrations support this PPL function, see Functions.

MD5

MD5 calculates the MD5 digest and returns the value as a 32 character hex string.

Usage: md5('hello')

Argument type:
  • STRING

Return type:
  • STRING

Example:

os> source=people | eval `MD5('hello')` = MD5('hello') | fields `MD5('hello')` fetched rows / total rows = 1/1 +----------------------------------+ | MD5('hello') | |----------------------------------| | <32 character hex string> | +----------------------------------+

SHA1

SHA1 returns the hex string result of SHA-1.

Usage: sha1('hello')

Argument type:
  • STRING

Return type:
  • STRING

Example:

os> source=people | eval `SHA1('hello')` = SHA1('hello') | fields `SHA1('hello')` fetched rows / total rows = 1/1 +------------------------------------------+ | SHA1('hello') | |------------------------------------------| | <40-character SHA-1 hash result> | +------------------------------------------+

SHA2

SHA2 returns the hex string result of SHA-2 family of hash functions (SHA-224, SHA-256, SHA-384, and SHA-512). The numBits indicates the desired bit length of the result, which must have a value of 224, 256, 384, 512

Usage:
  • sha2('hello',256)

  • sha2('hello',512)

Argument type:
  • STRING, INTEGER

Return type:
  • STRING

Example:

os> source=people | eval `SHA2('hello',256)` = SHA2('hello',256) | fields `SHA2('hello',256)` fetched rows / total rows = 1/1 +------------------------------------------------------------------+ | SHA2('hello',256) | |------------------------------------------------------------------| | <64-character SHA-256 hash result> | +------------------------------------------------------------------+ os> source=people | eval `SHA2('hello',512)` = SHA2('hello',512) | fields `SHA2('hello',512)` fetched rows / total rows = 1/1 +------------------------------------------------------------------+ | SHA2('hello',512) | | |------------------------------------------------------------------| | <128-character SHA-512 hash result> | +------------------------------------------------------------------+