File: md5test.hs

package info (click to toggle)
haskell-puremd5 2.1.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 76 kB
  • sloc: haskell: 267; makefile: 2
file content (14 lines) | stat: -rw-r--r-- 354 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import Control.Arrow
import Data.ByteString.Lazy.Char8
import Data.Digest.Pure.MD5
import Test.QuickCheck

instance Arbitrary Char where
  arbitrary = choose ('A', 'Z')

md5parts =
  (uncurry ((md5Finalize .) . md5Update . md5Update md5InitialContext) .)
  . curry (pack *** pack)

prop_md5 xs ys = show (md5 (pack (xs ++ ys))) == show (md5parts xs ys)