cardano-crypto-1.3.0: Cryptography primitives for cardano
Safe HaskellSafe-Inferred
LanguageHaskell2010

Crypto.Math.Bytes

Synopsis

Documentation

data Bytes (n :: Nat) Source #

Instances

Instances details
Show (Bytes n) Source # 
Instance details

Defined in Crypto.Math.Bytes

Methods

showsPrec :: Int -> Bytes n -> ShowS #

show :: Bytes n -> String #

showList :: [Bytes n] -> ShowS #

Eq (Bytes n) Source # 
Instance details

Defined in Crypto.Math.Bytes

Methods

(==) :: Bytes n -> Bytes n -> Bool #

(/=) :: Bytes n -> Bytes n -> Bool #

data Endian Source #

Constructors

LittleEndian 
BigEndian 

Instances

Instances details
Show Endian Source # 
Instance details

Defined in Crypto.Math.Bytes

Eq Endian Source # 
Instance details

Defined in Crypto.Math.Bytes

Methods

(==) :: Endian -> Endian -> Bool #

(/=) :: Endian -> Endian -> Bool #

pack :: forall n. KnownNat n => [Word8] -> Bytes n Source #

packSome :: (forall n. KnownNat n => Bytes n -> a) -> [Word8] -> a Source #

fromBits :: forall n. KnownNat n => Endian -> FBits n -> Bytes (Div8 n) Source #

transform bits into bytes with a specific endianness

toBits :: Endian -> Bytes n -> FBits (n * 8) Source #

transform bytes into bits with a specific endianness

append :: forall m n r. (m + n) ~ r => Bytes n -> Bytes m -> Bytes r Source #

take :: forall n m. (KnownNat n, n <= m) => Bytes m -> Bytes n Source #

drop :: forall n m. (KnownNat m, KnownNat n, n <= m) => Bytes m -> Bytes n Source #

splitHalf :: forall m n. (KnownNat n, (n * 2) ~ m) => Bytes m -> (Bytes n, Bytes n) Source #