RosettaCodeData/Task/CRC-32/Haskell/crc-32-2.hs
2023-07-01 13:44:08 -04:00

13 lines
352 B
Haskell

import Data.List (genericLength)
import Numeric (showHex)
import Foreign.C
foreign import ccall "zlib.h crc32" zlib_crc32 ::
CULong -> CString -> CUInt -> CULong
main :: IO ()
main = do
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 ""