If you are building any kind of login system or you need file signatures in Delphi XE5 Firemonkey you may be looking for an MD5 hash function. MD5 hash functionality ships with Delphi XE5 in the Indy component set. An MD5 hash is basically a string of unique characters that will represent the data you give it whether it is a password or an MP3 file. However, the code to access it is rather long which is where this library called hashutil comes in. The library should be cross platform and run on Windows, Android, IOS, and OSX. It provides some wrapper functions around the MD5 hash functionality which makes it easier to use. There is a function for a straight string, a stream, and a file. These three functions cover a lot of the usage and formats that you might need an MD5 hash for. You could for example get the MD5 hash for a list of MP3 files and use the hash as a fingerprint to see if there are duplicate files.. You could also create an MD5 hash of a password so that you are not storing the actual password in clear text. Here is a sample function:
function MD5(S: String): String;
begin
with TIdHashMessageDigest5.Create do
begin
Result := HashStringAsHex(S);
DisposeOf;
end;
end;
Head over and download the hashutil library code snippet for use in your projects.
Hi ,
I am trying to get a api or component which is Delphi XE5 equivalent of SHA1Managed. I tried all the alternatives available on net but i am not getting any proper results. In C# i am first UnicodeEncoding the string and then computing hash. I found couple of components like JEDI,or some custom build but non of them are giving me proper result. I have tried Indy as well but i am still failing in getting a proper result.
Thanks in advance.
Vijay K