[fpc-devel] Implementing SHA256 Unit.

Michael Van Canneyt michael at freepascal.org
Sun Mar 20 10:14:11 CET 2016



On Sun, 20 Mar 2016, Garry Wood wrote:

>> I'm trying to write a sha256 implementation in pure pascal like sha1 and md5 units.
>> With negative results.
>> Someone can helpme with this?
>
> I recently ported the implementation from LibTimCrypt / wpa_supplicant (which are both from public domain implementations), you can find the unit here:
>
> https://github.com/ultibohub/Core/blob/master/source/rtl/ultibo/core/crypto.pas
>
> This is for our Ultibo embedded project but the code is pure pascal and should compile for any platform if you adjust the uses clause.
>
> This has been validated against a number of test vectors available from different sources and seems correct although I can’t test on big endian CPU at present. The unit also includes ports of AES, DES, DES3 and RC4 ciphers as well as MD5 and SHA1.

Would it be OK to extract some of the routines and include them in Free Pascal
using the usual license ? We have several of these routines, but not all, it
would be nice to have a more complete set available by default.

Michael.


More information about the fpc-devel mailing list