Skip to content

MD5Convert ​

The MD5Convert function converts a MD5 hash string from one format to another.

The aTo parameter represents the format for the output.

The input hash aHash should always be of the opposite type.

Declaration: Function MD5Convert( aHash : string; aTo : TFloMD5HashType) : string;

Examples follow.

pascal
procedure OnMapEvent(var Value:Variant);
var
  MyString : string;
  hvar, hvar1, hvar2 : string;
  hsvar, hsvar1, hsvar2 : string;
begin
 //Make an MD5Hash in Base64
 //Result will be 'q45qsH1Hx/+kPi+ajgfxrw=='
  MyString := MD5Hash('Hello Cameron');

 //Converts from Base64 into Hex
 //Result from all 3 below will be 'AB8E6AB07D47C7FFA43E2F9A8E07F1AF'
  hvar := MD5Convert('q45qsH1Hx/+kPi+ajgfxrw==', fhtHex);
  hvar1 := MD5Convert(MD5Hash('Hello Cameron'), fhtHex);
  hvar2 := MD5Convert(MyString, fhtHex);

 //Converts from Hex into Base64
 //The result from all 3 below will be 'q45qsH1Hx/+kPi+ajgfxrw=='
  hsvar := MD5Convert('AB8E6AB07D47C7FFA43E2F9A8E07F1AF', fhtBase64);
  hsvar1 := MD5Convert(MD5HashHex('Hello Cameron'), fhtBase64);
  hsvar2 := MD5Convert(hvar, fhtBase64);

end;