What hash algorithms does Delphi support?
If you want an MD5 digest and have the Indy components installed, you can do this:
uses SysUtils, IdGlobal, IdHash, IdHashMessageDigest;
with TIdHashMessageDigest5.Create do
try
Result := TIdHash128.AsHex(HashValue('Hello, world'));
finally
Free;
end;
Most popular algorithms are supported in the Delphi Cryptography Package:
- Haval
- MD4, MD5
- RipeMD-128, RipeMD-160
- SHA-1, SHA-256, SHA-384, SHA-512,
- Tiger
You can also use the WindowsCrypto API with Delphi:
There is a unit in there that wraps all the CryptoAPI. You can also use Lockbox, which is now open source.
In the end you can support pretty much any Hash algorithms with Delphi. The Indy example is probably the closest you will get to natively in Delphi since Indy is included with most versions of Delphi. For the rest you will need to either use a library or write some more code to access the CryptoAPI or implement it yourself.
As a side note, as of Delphi 2009, all objects in Delphi have a GetHashCode method.
I usually use DCPCrypt2 (Delphi Cryptography Package) from David Barton (City in the Sky).
It is also contains the following Encryption Algorithms:
- Blowfish
- Cast 128
- Cast 256
- DES, 3DES
- Ice, Thin Ice, Ice2
- IDEA
- Mars
- Misty1
- RC2, RC4, RC5, RC6
- Rijndael (the new AES)
- Serpent
- Tea
- Twofish