Hash value sizes

For giggles, here are examples of hashes for the SHA1, SHA256 and SHA512 hashing mechanisms.

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
echo hash_hmac(
  'sha1',
  openssl_random_pseudo_bytes(32),
  openssl_random_pseudo_bytes(32)
) . "\n";
 
echo hash_hmac(
  'sha256',
  openssl_random_pseudo_bytes(32),
  openssl_random_pseudo_bytes(32)
) . "\n";
 
echo hash_hmac(
  'sha512',
  openssl_random_pseudo_bytes(32),
   openssl_random_pseudo_bytes(32)
) . "\n";

Output

1
2
3
00666100c04543601c9de450b061b4bbc5538c50
5762b94cd40d3e62c7b343df1ca3511343dc00fd99a4f1ee64988bf523c13b8a
49cae01474cfd4adfa21e94d35dd93a1f808dff4538042d5140fc661773bc8d0019311ee3dcb7ed8e2a27b021ae47c006f9a477fb768f60256276cc99e8c4bd0

Have a good weekend.

Related posts

Leave a Comment