cryptonite/Crypto/Cipher/DES/Serialization.hs
Vincent Hanquez ec4e0c4ed9 remove all the byteArray prefix from byteArray function.
instead expect module import to be qualified for functions.
2015-04-24 06:54:33 +01:00

24 lines
599 B
Haskell

-- |
-- Module : Crypto.Cipher.DES.Serialization
-- License : BSD-style
-- Maintainer : Vincent Hanquez <vincent@snarc.org>
-- Stability : stable
-- Portability : good
--
-- basic routine to convert between W64 and bytestring for DES.
--
module Crypto.Cipher.DES.Serialization
( toBS
) where
import qualified Data.ByteString as B
import Crypto.Cipher.DES.Primitive (Block(..))
import qualified Crypto.Internal.ByteArray as B
import Crypto.Internal.Endian
import Foreign.Storable
toBS :: Block -> B.ByteString
toBS (Block w) = B.allocAndFreeze 8 $ \ptr -> poke ptr (toBE64 w)