Mawg
Mawg

Reputation: 40159

Seeking FOSS SHA1

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

Answers (4)

Premature Optimization
Premature Optimization

Reputation: 1938

You most probably already have SHA-1 implementation preinstalled within IdHashSHA1 unit (part of Indy 10).

Upvotes: 3

Arnaud Bouchez
Arnaud Bouchez

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

Rob Kennedy
Rob Kennedy

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

Mick
Mick

Reputation: 13475

TurboPower LockBox is free and open-source and implements SHA1, as well as many others:

Features

  • AES
  • SHA2 (including the new SHA-512/224 & SHA-512/256)
  • DES/3DES
  • Blowfish
  • Twofish
  • SHA1
  • MD5
  • RSA Sign & Verify
  • Chaining modes: ECB, CBC, CFB8, CFB, CTR, ECB, OFB, PCBC

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

Related Questions