Changes between Version 2 and Version 3 of WikiStart

Show
Ignore:
Timestamp:
09/15/10 22:32:30 (4 years ago)
Author:
TomMD (IP: 131.252.223.19)
Comment:

Basic page start

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart

    v2 v3  
    11= Crypto-API = 
     2A generic interface for cryptographic operations, platform independent quality RNG, property tests and known-answer tests (KATs) for common algorithms, and a basic benchmark infrastructure. 
    23 
    3 http://hackage.haskell.org/package/crypto-api 
     4Hackage: http://hackage.haskell.org/package/crypto-api 
     5 
     6= Testing = 
     7Using crypto-api for testing is absurdly simple and particularly useful if you are implementing one of the algorithms for which NIST CAVP provides known answer tests (KATs).  For example: 
     8 
     9{{{ 
     10    import Test.SHA 
     11    import Test.HMAC 
     12    import Test.Crypto 
     13    import Data.CryptoHash.SHA512 
     14    import Data.CryptoHash.SHA384 
     15 
     16    main = do 
     17        t1 <- makeSHA512Tests (undefined :: SHA512) 
     18        t2 <- makeSHA384Tests (undefined :: SHA384)         
     19        runTests (concat [t1,t2]) 
     20 
     21        h1 <- makeSHA512HMACTests (undefined :: SHA512) 
     22        h2 <- makeSHA384HMACTests (undefined :: SHA384) 
     23        runTests $ concat [h1,h2] 
     24}}} 
     25 
     26And the run: 
     27 
     28{{{ 
     29    [tommd@Mavlo Test]$ ghc --make sha.hs 
     30    [1 of 1] Compiling Main             ( sha.hs, sha.o ) 
     31    Linking sha ... 
     32    [tommd@Mavlo Test]$ ./sha | grep True | wc -l 
     33    844        
     34    [tommd@Mavlo Test]$ ./sha | grep False | wc -l 
     35    0   
     36}}}