util.hashes API

Provides utility functions for hashing strings according to several popular algorithms.

The algorithms currently supported are:

  • MD5
  • SHA1
  • SHA2-256
  • SHA2-512
  • PBKDF2 with SHA1

Usage

Reference

Hash functions

All of the above functions return a hash string according to the chosen algorithm. By default the raw binary form is returned, most often you will want to pass true as the second parameter to get a nice hex-encoded string.

HMAC functions

All of the above functions return a hash string according to the chosen algorithm. By default the raw binary form is returned, most often you will want to pass true as the third parameter to get a nice hex-encoded string.

PBKDF2