Delphi base64 MD5 and sha1 encryption ticket (cnvcl)

Source: Internet
Author: User
Tags sha1 encryption

I have been studying base64 and sha1 in Delphi today, using units in cnvcl of http://www.cnpack.org, cnsha1.pas and cnbase64.pas. I am very grateful for the contributions of the cnpack group, we can easily use base64 and sha1 encryption in Delphi, as well as MD5.

The results of a single encryption operation are the same as those of PHP, that is, PHP uses lowercase letters and Delphi uses uppercase letters, but the results of the two encryption operations are completely different, because the results of case-sensitive secondary encryption are different, pay attention to this.

When using these three encryption methods, cnsha1, cnbase64, and cnmd5 units must be referenced respectively.

Delphi code

Str2: = lowercase (sha1print (sha1stringa ('000000 ')));

Str3: = lowercase (sha1print (sha1stringa (str2 )));

PHP code

Echo sha1 ('000000'). "\ n ";

Echo sha1 (sha1 ('20170101'). "\ n ";

After Delphi and lowercase are converted to lower case, the two results are consistent.


Delphi base64 MD5 and sha1 encryption ticket (cnvcl)

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.