Use md5sum to encrypt files

Source: Internet
Author: User

I have been using Python programming for the past three months since I graduated from college. I have been using many useful commands, and md5sum is one of them, which is used to encrypt files, this is about files. Of course, folders are not allowed. For friends who use python, I feel that he is very familiar with the OS module. I will not talk about it here, if you execute the md5sum command in the shell command bar, the output result is not returned as follows:

[Email protected]: ~ # Md5sum file name

Cd548c93316211184c06e6f2f6f609ba file name # The hexadecimal encoding of the string is randomly generated.

A string of encrypted files calculated by hash.

If we operate and execute OS. System ("md5sum file name") in the file, we will not be able to get this string of encrypted files. Only the execution success and failure results will be returned, that is, 0 and other values. Here, we can use redirection ("<") to output to a file to obtain the encrypted file and obtain the specific path of the file. The detailed command is as follows:

Cmd = 'OS. System ("md5sum file name")> output file'

OS. System (CMD)

After the above operations, you can obtain the detailed ciphertext in the file. We can verify the file in this way ~!

Use md5sum to encrypt files

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.