CRYPT_HASH_MODE
CRYPT_HASH_MODE
Pure-PHP implementations of keyed-hash message authentication codes (HMACs) and various cryptographic hashing functions.
Uses hash() or mhash() if available and an internal implementation, otherwise. Currently supports the following:
md2, md5, md5-96, sha1, sha1-96, sha256, sha256-96, sha384, and sha512, sha512-96
If {@link self::setKey() setKey()} is called, {@link self::hash() hash()} will return the HMAC as opposed to the hash. If no valid algorithm is provided, sha1 will be used.
PHP version 5
{@internal The variable names are the same as those in {@link http://tools.ietf.org/html/rfc2104#section-2 RFC2104}.}}
Here's a short example of how to use this library:
<?php
include 'vendor/autoload.php';
$hash = new \phpseclib\Crypt\Hash('sha1');
$hash->setKey('abcdefg');
echo base64_encode($hash->hash('abcdefg')); ?>
Hash | Pure-PHP implementations of keyed-hash message authentication codes (HMACs) and various cryptographic hashing functions. |