Cryptographic Library for DWScript

padlockThere is now an embryo of standard cryptography support for DWScript through the dwsCryptoLib module. The implementations are currently based on mORMot‘s SynCrypto unit, which is fast and solid.

Script-side it’s exposed as a System.Crypto unit, and offers the following classes:

  • HashAlgorithm
    • HashMD5
    • HashSHA1
    • HashSHA256
  • EncryptionAlgorithm
    • EncryptionAESSHA256Full

The classes are currently meant for static usage and rely on virtual class methods, ie. you don’t have to instantiate them, but can use them in code like

PrintLn( 'Here is the MD5: ' + HashMD5.HashData( whatever ) );

var myHash := HashSHA256;
PrintLn( 'and the SHA256: ' + myHash.HashData( whatever ) );

They will probably become “instantiatable” in the future for the purpose of hashing and performing data encryption incrementally.

3 thoughts on “Cryptographic Library for DWScript

  1. This is a real pleasure seeing mORMot’s units used in such a great Open Source project like DWS!
    Thanks for the interest and feedback!

  2. @Thomas Oops, now fixed, thanks for reporting!

    @Arnaud mORMot is full of little gems 😉 Any chance of seeing Keccak or SCrypt in SynCrypto as well?

Comments are closed.