Reputation: 40159
I am looking for a FOSS SHA1 implementation for use with Delphi (7).
Preferably something small, maybe even standalone SHA1, rather than past of a humongous library. Ease of install and use are nice, but of course reliability is priority number 1.
Update:Thanks, Rob, that code works like a dream
Upvotes: 8
Views: 2104
Reputation: 1938
You most probably already have SHA-1 implementation preinstalled within IdHashSHA1
unit (part of Indy 10).
Upvotes: 3
Reputation: 43033
You have Open Source MD5, SHA-1, SHA-256, and Adler32 implementation in the SynCrypto.pas unit. There is also included AES-256 encryption.
This unit was very optimized for speed (the SHA-256 an AES-256 was even profiled at asm level), and can also use the very fast real-time instructions of the VIA C3/C7/Nano CPU if available.
Works from Delphi 6 up to XE.
Upvotes: 5
Reputation: 163287
Use the Cryptography API built in to the OS. You can use the Hashes.pas unit by Domingo Seoane to use it in Delphi, or you can write your own routine using CryptAcquireContext, CryptCreateHash, repeated calls to CryptHashData, and finally CryptGetHashParam to get the result.
I realize it's neither free (as in speech) nor open source, but there are also no distribution requirements since it's included on all your customers' systems already.
Upvotes: 6
Reputation: 13475
TurboPower LockBox is free and open-source and implements SHA1, as well as many others:
Features
Version 3 officially supports Delphi 2007 and Delphi 2010 (but may work with Delphi 7), but Version 2 has support for older versions of Delphi.
Upvotes: 5