HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Modulecryptonite-0.30Haskell2010

Crypto.Number.Serialize

Fast serialization primitives for integer

  • 4 values
  • Packagecryptonite-0.30
  • Exports4
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceSerialize.hs
valuei2osp :: ByteArray ba => Integer -> ba
#

i2osp converts a positive integer into a byte string.

The first byte is MSB (most significant byte); the last byte is the LSB (least significant byte)

valuei2ospOf :: ByteArray ba => Int -> Integer -> Maybe ba
#

Just like i2osp, but takes an extra parameter for size. If the number is too big to fit in len bytes, Nothing is returned otherwise the number is padded with 0 to fit the len required.

valuei2ospOf_ :: ByteArray ba => Int -> Integer -> ba
#

Just like i2ospOf except that it doesn't expect a failure: i.e. an integer larger than the number of output bytes requested.

For example if you just took a modulo of the number that represent the size (example the RSA modulo n).