The encryption algorithm in Delphi (Md5,md4,md3 ...)

Source: Internet
Author: User
Tags md5
In fact, the Indy control in Delphi comes with MD2,MD4,MD5 objects, and we can use them directly to complete the MD5 signature algorithm. Instead of having to find other DLLs or pas.
It is possible to achieve MD5 by referencing the idhashmessagedigest unit in the uses cell and then writing the following code.

Sample Code procedure Tform1.button1click (Sender:tobject);
Var
MYMD5:TIDHASHMESSAGEDIGEST5;
Digest:t4x4longwordrecord;
Begin
MyMD5: = tidhashmessagedigest5.create;
Digest: = Mymd5.hashvalue (");
ShowMessage (' +: ' + mymd5.ashex (Digest)); Displays 32-character-length MD5 signature results
ShowMessage (' +: ' + Copy (Mymd5.ashex (Digest), 9, 16)); Displays 16-character-length MD5 signature results
End Description
The Mymd5.hashvalue function can be a string or a stream object that returns a result of type T4x4longwordrecord MD5 signed result
The Mymd5.ashex function converts the T4x4longwordrecord Md5 signature into a hexadecimal MD5 signature string.

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.