Hash¶
Hash has several meanings:
PHP extension
PHP function
A general computer science concept, that transforms data into another value
A general computer science concept, that turns a string into another fixed-sized string, in a way that is difficult to revert. It is also called a digest.
A synonym for arrays with arbitrary keys, also known as map or associative array
A character to start a one line comment:
#
Hash allows direct or incremental processing of arbitrary length messages using a variety of hashing algorithms.
While the extension hash only process hashes, there are other extensions which offer these features: openssl, sodium and password hashing. Mhash and mcrypt are older PHP extensions, which are now discontinued.
<?php
echo hash('ripemd160', 'The quick brown fox jumped over the lazy dog.');
// produces ec457d0a974c48d5685a7efa03d137dc8bbde7e3
// a conversion table is a hash
$c = 2;
$dictionary = [1 => 'a', 2 => 'b', 3 => 'c'];
echo $dictionary[$c];
// This is a hashmap, or also called a hash
$hashMap = ['name' => 'Henry',
'family' => 'Troyat',
'age' => 33,
];
?>
See also Numeric hash (nhash) in PHP.
Related : hash() Function, Cryptographic Hash, Collection, Array, Map, Array Element, Convert, Magic Hash, Secure Hash Algorithm (SHA), Hash #, Argon2, Automatic Index, Dictionary, Data Structure, Pound #, array_column, Cyclic Redundancy Check 32-bit (CRC32), HMAC, Password API, Bucket, Hash Comparisons, Single Sign On (SSO)