1. Oppnssl MD5 method of encrypting string
A. Manual input commands and procedures are as follows:
The code is as follows:
#openssl//Enter OpenSSL in the terminal and return.
openssl> MD5//input MD5 rear carriage
123456//Then enter 123456, do not enter a carriage return. Then press 3 times for ctrl+d.
123456e10adc3949ba59abbe56e057f20f883e//123456 behind that is the ciphertext.
Explanation: Why not return after entering 123456?
Because OpenSSL the return character as one of the characters in the string to be encrypted, the result is different. If you enter 123456 return, press 2 times ctrl+d. The results obtained are:
The code is as follows:
Openssl> MD5
123456
F447B20A7FCBF53A5D5BE013EA0B15AF//Because the OpenSSL does not ignore the carriage return caused by the
B. or directly by pipe command
The code is as follows:
# echo-n 123456 | OpenSSL MD5//must have the-n parameter, otherwise it will not be the result.
e10adc3949ba59abbe56e057f20f883e
Explanation: Why do I need to add the-n parameter?
-n means that a carriage return is not entered in order to get the correct result. If you don't add-N, the result is the same as the previous one:
The code is as follows:
F447B20A7FCBF53A5D5BE013EA0B15AF//Because the OpenSSL does not ignore the carriage return caused by the
2. Encrypt files with OpenSSL.
The code is as follows:
#openssl MD 5-in 1.txt