How to create md5 hash via Arch Linux commandline?
Simply echo
it to md5sum.
The first result will consider a newline character in the end of the string, prior to generating the hash.
$ echo P@ssword1 | md5sum
0a43c426e3d6764fe1f3f7cbb3579eba -
Otherwise as @AFH states if you wish to not have a newline character do the following:
$ echo -n 'P@ssword1' | md5sum
d106b29303767527fc11214f1b325fb6 -
None of the answers mention that with echo -n 'password' | …
, you will write your password to persistent storage, namely your history.
You can avoid this, depending on the shell, by prefixing the command with a space (test this for your shell). Read up on your shells documentation on how this is handled.
Alternatively, you can use md5sum
directly, by running md5sum
, typing the password and then Ctrl+D. Do not hit Enter between the password and Ctrl+D, unless you want to have include a newline in the hash.
Here is an example using openssl
echo -n 'stack overflow' | openssl md5
(stdin)= 481b8423202598ecfb233c5fa68caf68
Openssl implement several different hashing algorithms, if you need a different one some day.