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