The checksum function is used to calculate the checksum of a set of expressions, which is int, and for the same set of expressions, the checksum is the same, and in rare cases, different expressions have the same checksum. This feature of the
MD5 Algorithm Introduction:MD5 Full name is the paper Digest to the algorithm (Message-digest ALGORITHM5), the algorithm for arbitrary length of information is calculated bitwise, resulting in a binary length of 128 bits (hexadecimal length is 32
#coding: GBK#md5SHA1 file Check value calculation# How to use: python file . PY Validating FilesImport HashlibImport SysImport OSdefmd5_sum (filename): # Check Value Methodfd=open (filename, "RB") # Open FileFd.seek (0) # move the file hit tag to
Checksum (TRANSACT-SQL)
Returns the verification value calculated based on a row or a group of expressions in the table. Checksum is used to generate a hash index.
Transact-SQL syntax conventions
Syntax
Checksum (* |
Using Python to generate the file md5 checksum function,
Preface
In linux, there is a command called md5sum, which can generate the md5 value of the file. Generally, the result is recorded in a file for verification. For example, it will be used as
WHttps://en.wikipedia.org/wiki/Checksumhttps://zh.wikipedia.org/wiki/ChecksumA checksum is a small-sized datum derived from a block of digital data for the purpose of detecting errors which May has been introduced during its transmission or storage.
Objective
In Linux there is a command called md5sum, can generate the MD5 value of the file, in general, the results will be recorded in a file for validation use, such as the use of:
[Crazyant@localhost pythonmd5]$ more Sample_file
I. Brief description
MD5: All called message digest algorithm 5 (Information digest algorithm), can be encrypted, but not decrypted, belong to one-way encryption, usually used for file verification
BASE64: The 8-bit byte of any sequence is
Linux to verify the file MD5 value, the easiest way is to execute the md5sum commandmd5sum filenameOriginally intended to use subprocess to invoke system commands to get MD5 values,
Import Subprocess,shlex
cmd = "md5sum filename"
p = subprocess
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.