A hashing function is used to calculate a hash value. If you insert a file into a hashing function then it should produce a value that is almost certain to be unique (there’s always the remote likelihood that no matter how good your function, you may end up with a duplicate).
The openssl command is used to access a number of functions/ciphers including sha1, base64, md5, rc4/rc5 and of course des/des3. It is a very simple command to use, simply provide the cipher, followed by the path to the file you would like to get a hash value (aka digest) for. So if I have a file called myfile.txt and I would like to get a digest for it I could just use the following command:
openssl md5 myfile.txt
At its most basic level, we’re just leveraging openssl to grab digests quickly and easily.
krypted March 27th, 2009
Posted In: Mac OS X, Mac OS X Server, Mac Security
des3, Mac OS X, Mac Security, md5, openssl, sha1
A checksum can be used to determine if a file has been tampered with at a later date. To run a checksum use the following command:
openssl dgst -HASHTYPE path_to_file
HASHTYPE would then be md2, md4, md5, mdc2, rmd160, sha or sha1. Let’s go ahead and do a checksum of our smb.conf file:
openssl dgst -md5 /var/db/smb.conf
You should then see output similar to the following:
krypted May 27th, 2006
Posted In: Mac OS X, Mac Security, Ubuntu, Unix
hash, md2, md5, openssl, sha1, smb.conf