Hashes and Message Authentication Codes
Index
Hash generation
OpenSSL also has features for generating hashes of various types.
Generate hash of a file
Using SHA1
Using SHA256
Using RIPEMD160
It is also possible to use the openssl dgst
command to create hashes from data.
Listing the available hash functions
To list the available hash functions, simply do:
This will present all the hash functions that are supported by openssl:
Create a hash from a file
To create a hash from a specific file, we need to do:
That produces the appropriate value:
Create a hash with a "salt"
The following command will create a hash value from a password (mypassword
) with a "salt" value (mysaltvalue
) - using the SHA256:
Generate a Message Authentication Code
In order to generate a hash-based message authentication code, we need to provide the hash algorithm to be used and the secret key to encrypt the hash.
Last updated