PHP Security Password Protection With the Hash_hmac Function

October 21, 2011 | By Duchateaux.

PHP 5 Password Security Protection with hash_hmac

This function represents in PHP 5 the Best Hashing Tool.

It’s enabled by Default from PHP version 5.1+ It dispose of Several Hashing Algorithms and between them: MD5, SHA1, SHA256 and SHA512. For a complete list of Hash Algorithms view Output of the hash_algos() function.

The function take Up to 4 Arguments and only the last is Optional:

PHP 5.6 Installation in Ubuntu 22.04 – Step-by-step
  1. The Algorithm in Use

  2. The Data to be Hashed

  3. The Hash Key
    which make the generated Hash Unique.
    The Key must be Used when Comparing two Hashes.

  4. The Hash Output Format
    this is Optional. True give a raw Binary and False Hexadecimal chars.

Example:

hash_hmac('sha256', $password, 'xyzhkj', true)

QuickChic Theme • Powered by WordPress