Home > Back-end >  PHP md5 (' 123456789 ', TRUE) for Delphi how to write
PHP md5 (' 123456789 ', TRUE) for Delphi how to write

Time:11-04

To the original 16 characters binary format, as a result of PHP,

CodePudding user response:

The function GetStringMd5 (STR: string; UTF8_Encode: Boolean=true;
Tolow: Boolean=false; Key: string='; Tohex: Boolean=true) : string;
Var s: a string;
The begin
S:=STR + key;
If tolow then
S:=LowerCase (s);
If UTF8_Encode=false then
The begin
If tohex then
Result:=MD5Print (MD5String (s))
The else
Result:=MD5ToStr (MD5String (s));
End
The else
The begin
If tohex then
Result:=MD5Print (MD5String (UTF8Encode (s)))
The else
Result:=MD5ToStr (MD5String (UTF8Encode (s)));
end;

CodePudding user response:

The function MD5ToStr (D: MD5Digest) : ansistring;
Var I: Integer;
The begin
Result:=';
For I:=0 to 15 do
Result: the result=+ ansichar [I] (d);
end;

CodePudding user response:

You might as well be the result of the PHP directly using Hex string, is' 25 f9e794323b453885f5181f1b624d0b '?

refer to the original poster WZQCJQ response:
16 characters to the original binary format, the result of PHP is:

CodePudding user response:

USES the System. The Hash;
And then directly: THashMD5 GetHashString (' 123456789 ');

  • Related