Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodCode SnippetDelphiFiremonkeyIOSOSXWindows

MD5 Hash Strings, Streams, And Files In Delphi XE5 Firemonkey For IOS And Android

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE5 Firemonkey MD5 Hash | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSIf 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;
with TIdHashMessageDigest5.Create do
Result := HashStringAsHex(S);

Head over and download the hashutil library code snippet for use in your projects.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts

AutoBlogAI: FireMonkey Client To Leverage LLMs And Generative AI For Blogging


Unleashing Creativity With Song Writer AI: A Deep Dive


How To Build Stable Diffusion Text To Image Prompts


FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes

Sign up for our Newsletter and
stay informed

1 Comment

Leave a Reply