pbkdf2_hmac – Generate a salted PBKDF2_HMAC password hash

Note

This filter plugin is part of the middleware_automation.amq collection.

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install middleware_automation.amq.

To use it in a playbook, specify: middleware_automation.amq.pbkdf2_hmac.

New in middleware_automation.amq 1.1.0

Synopsis

  • Generate a salted one-way PBKDF2 HMAC_password hash

Input

This describes the input of the filter, the value before | middleware_automation.amq.pbkdf2_hmac.

Parameter

Comments

Input

string / required

the unencrypted input password

Keyword parameters

This describes keyword parameters of the filter. These are the values key1=value1, key2=value2 and so on in the following example: input | middleware_automation.amq.pbkdf2_hmac(key1=value1, key2=value2, ...)

Parameter

Comments

hashname

string

the hash name, among ['sha1', 'sha224', 'sha256', 'sha384', 'sha512']

Default: "sha1"

hexsalt

string / required

salt for password hashing, in uppercase hexstring format

iterations

integer

number of iterations, default 1024

Examples

# generate pbkdf2_hmac hash in hex format for 'password' with given salt
- name: Generate salted PBKDF2_HMAC password hash
  ansible.builtin.debug:
    msg: >-
      {{ 'password' | pbkdf2_hmac(hexsalt='7BD6712B68F9BD60B51D77EBD851A21F63E61F2B52301E7CA38DD1602CA662EB' }}

# generate pbkdf2_hmac hash in hex format for 'password' using 20000 iterations of sha256
- name: Generate salted PBKDF2_HMAC password hash
  ansible.builtin.debug:
    msg: >-
      {{ 'password' | pbkdf2_hmac(hashname='sha256', iterations=20000, hexsalt='7BD6712B68F9BD60B51D77EBD851A21F63E61F2B52301E7CA38DD1602CA662EB' }}

Return Value

Key

Description

Return value

string

the uppercase hexstring representation of the hashed password

Returned: success

Authors

  • Guido Grazioli

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.