Ways to encrypt files in a Linux system

Source: Internet
Author: User
Tags md5 openssl openssl md5

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.