Hash SHA-512 with key

Hash SHA-512 with Key

Description

Applies a SHA-512 hash to the field concatenated with a key.

Category

Pseudonymization

Supported Field Types

  • text
  • timestamp
  • date
  • float
  • int
  • boolean
  • time

Output Field Type

  • text

Arguments

  • Key: The key that will be concatenated with the original field value before applying the hash.

Pseudo-code (Python)

def func(val, key):
    """
        val: field value
        key: key text
    """
    import hashlib
    if val:
        sha = hashlib.sha512()
        data = "%s%s" % (key, val)
        sha.update(data.encode('utf-8'))
        return sha.hexdigest()
    else:
        return None