MD5 validation file Consistency in Java

Source: Internet
Author: User
Tags md5

COMMONS-CODEC packages can be downloaded from Apache: http://commons.apache.org/codec/download_codec.cgi

MD5 is now used as a digital signature algorithm, where a sends data m to B, in order for B to be convinced that the data is sent by a and not tampered with, so a is hashing the data into a hash algorithm and sending it to B. b After receiving the file, the same hash algorithm is used to verify that the data is modified. Primarily to prevent data from being modified. The repetition of the MD5 value is called collision.

get MD5 code for file:

System.out.println (New FileInputStream ("c:/ttt/new1328505655521")) (New File ("Digestutils.md5hex"));

Get string MD5 code:

System.out.println (Digestutils.md5hex (string));

Reference article: http://hi.baidu.com/xghrbc1001/item/9bf046e7d95d9caac00d754b

Linux View file MD5 value command

Md5sum local_nikitrailer1.flv

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.