Showing posts with label Cryptographic hash function. Show all posts
Showing posts with label Cryptographic hash function. Show all posts

Monday, February 1, 2016

SHA-2: Command Comparison

Using command "shasum":
$ echo -n "test" | shasum -a 256
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 -


Using command "openssl dgst":
$ echo -n "test" | openssl dgst -sha256
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08


Using command "openssl dgst" with option "hmac" with secret key:
$ echo -n "test" | openssl dgst -sha256 -hmac \"SECRET\"
c5790721d9fc3b84a46034c7b80d7b01d92f41a2847e67d17d8cc6cc97a6c7ad


Sunday, January 31, 2016

MD5: Testing Out MD5 Behaviour

MD5 hash using s option:
md5 -s "test string"
MD5 ("test string") = 6f8db599de986fab7a21625b7916589c


MD5 hash using pipe:
echo -n test string | md5
6f8db599de986fab7a21625b7916589c


MD5 hash using pipe, but echo without n option:
echo test string | md5
f299060e0383392ebeac64b714eca7e3