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)