2014-04-02 16:56:35 +00:00
|
|
|
import Data.List (genericLength)
|
|
|
|
|
import Numeric (showHex)
|
|
|
|
|
import Foreign.C
|
|
|
|
|
|
2019-09-12 10:33:56 -07:00
|
|
|
foreign import ccall "zlib.h crc32" zlib_crc32 ::
|
|
|
|
|
CULong -> CString -> CUInt -> CULong
|
2014-04-02 16:56:35 +00:00
|
|
|
|
2019-09-12 10:33:56 -07:00
|
|
|
main :: IO ()
|
2014-04-02 16:56:35 +00:00
|
|
|
main = do
|
2019-09-12 10:33:56 -07:00
|
|
|
let s = "The quick brown fox jumps over the lazy dog"
|
|
|
|
|
ptr <- newCString s
|
|
|
|
|
let r = zlib_crc32 0 ptr (genericLength s)
|
|
|
|
|
putStrLn $ showHex r ""
|