To explain the MD5 code and SHA1 Code of Linux Lieutenant-Test files

Source: Internet
Author: User
Tags md5 md5 encryption sha1

Md5sum

Usage: md5sum [options] ... [File] ...

Displays or checks the MD5 (128-bit) checksum.

If there is no file option, or if the file is "-", read from the standard input.

-B,--binary read in binary mode

-C,--check read the MD5 checksum from the file and check it

-T,--text read in plain text mode (default)

The following three options are useful for checksums:

--quiet file output is not successful for validation ok

--status does not output any content, displays success using exit status number

-W,--warn warning of malformed checksum rows

--strict with--check, exit Non-zero for any invalid input

--HELP displays this help information and exits

--version display version information and exit

Checksums are generated in accordance with the RFC 1321 specification. When checking, the input format given should and the output of the program

Boilerplate format is the same. The default output mode outputs a checksum of one line checksum, and has a character

Represents a file type ("*" represents a binary, "" represents plain text), and displays the name of each file at the same time.

Example 1

The code is as follows:

[Root@linux ~]# md5sum-b Test #以二进制进行读取

832df9d3d18471d80d67bee644eebb8a *test

Example 2

The code is as follows:

[Root@zhangwei scripts]# md5sum zzz > ZZZ.MD5 # Generate MD5 encryption test and

[Root@zhangwei scripts]# md5sum-c ZZZ.MD5 # Inspection is consistent with the file,

Sha1sum

Sha1sum a unique hash algorithm for a file,

Usage: sha1sum [OPTION] [FILE] ...

Parameters:

-B,--binary binary mode read

-C,--check check file according to SHA1 num

-T,--text text mode read (default)

Cases:

The code is as follows:

[SHA1 value of Root@localhost ~]# sha1sum install.log #install. Log

0750a96a87738a2d2173bbee12e40e6ab17136c6 Install.log

The code is as follows:

[Root@localhost ~]# sha1sum-b Install.log #二进制模块读取

0750a96a87738a2d2173bbee12e40e6ab17136c6 *install.log

The code is as follows:

[root@localhost ~]# sha1sum install.log > AA

[root@localhost ~]# sha1sum-c aa #根据sha1值, check file

Install.log:OK

Related Article

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.