Crypto.Number.Serialize.Internal

cryptonite-0.13: Cryptography Primitives sink

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | Good
Safe Haskell | None
Language | Haskell2010

Crypto.Number.Serialize.Internal

Description

fast serialization primitives for integer using raw pointers

Synopsis

- i2osp :: Integer -> Ptr Word8 -> Int -> IO Int
- i2ospOf :: Integer -> Ptr Word8 -> Int -> IO Int
- os2ip :: Ptr Word8 -> Int -> IO Integer

# Documentation

i2osp :: Integer -> Ptr Word8 -> Int -> IO Int

fill a pointer with the big endian binary representation of an integer

if the room available @ptrSz is less than the number of bytes needed, 0 is returned. Likewise if a parameter is invalid, 0 is returned.

returns the number of bytes written

i2ospOf :: Integer -> Ptr Word8 -> Int -> IO Int

Similar to `i2osp`, except it will pad any remaining space with zero.

os2ip :: Ptr Word8 -> Int -> IO Integer

transform a big endian binary integer representation pointed by a pointer and a size into an integer