diff --git a/README.md b/README.md index 20dcacd..9c135c9 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,9 @@ Links * [Salsa128-test-vectors](https://github.com/alexwebr/salsa20/blob/master/test_vectors.128) * [Salsa256-test-vectors](https://github.com/alexwebr/salsa20/blob/master/test_vectors.256) +* [PBKDF2](http://tools.ietf.org/html/rfc2898) +* [PBKDF2-test-vectors](http://www.ietf.org/rfc/rfc6070.txt) + TODO ---- diff --git a/tests/KAT_PBKDF2.hs b/tests/KAT_PBKDF2.hs new file mode 100644 index 0000000..1a32c33 --- /dev/null +++ b/tests/KAT_PBKDF2.hs @@ -0,0 +1,31 @@ +{-# LANGUAGE OverloadedStrings #-} + +-- from +module KAT_PBKDF2 (vectors) where + +import Data.ByteString (ByteString) +import qualified Data.ByteString as B +import Data.ByteString.Char8 () + +type VectParams = (ByteString, ByteString, Int, Int) + +-- PBKDF-HMAC-SHA1 +vectors :: [ (VectParams, ByteString) ] +vectors = + [ + ( ("password","salt",2,20) + , "\xea\x6c\x01\x4d\xc7\x2d\x6f\x8c\xcd\x1e\xd9\x2a\xce\x1d\x41\xf0\xd8\xde\x89\x57" + ) + , ( ("password","salt",4096,20) + , "\x4b\x00\x79\x01\xb7\x65\x48\x9a\xbe\xad\x49\xd9\x26\xf7\x21\xd0\x65\xa4\x29\xc1" + ) + + , ( ("passwordPASSWORDpassword", "saltSALTsaltSALTsaltSALTsaltSALTsalt", 4096, 25) + , "\x3d\x2e\xec\x4f\xe4\x1c\x84\x9b\x80\xc8\xd8\x36\x62\xc0\xe4\x4a\x8b\x29\x1a\x96\x4c\xf2\xf0\x70\x38" + ) + , ( ("pass\0word", "sa\0lt", 4096, 16) + , "\x56\xfa\x6a\xa7\x55\x48\x09\x9d\xcc\x37\xd7\xf0\x34\x25\xe0\xc3" + ) + ] + +