Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Efficient representation for small bytearrays with 128 or 256 bits.
Synopsis
- data Word128 = Word128 {
- w128_first :: !Word64
- w128_second :: !Word64
- data Word256 = Word256 {
- w256_first :: !Word128
- w256_second :: !Word128
- bsToW128 :: ByteString -> Word128
- w128ToBs :: Word128 -> ByteString
- bsToW256 :: ByteString -> Word256
- w256ToBs :: Word256 -> ByteString
- xorW128 :: Word128 -> Word128 -> Word128
- xorW256 :: Word256 -> Word256 -> Word256
Documentation
Word128 | |
|
Instances
Data Word128 Source # | |
Defined in Data.LargeHashable.LargeWord gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word128 -> c Word128 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word128 # toConstr :: Word128 -> Constr # dataTypeOf :: Word128 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word128) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word128) # gmapT :: (forall b. Data b => b -> b) -> Word128 -> Word128 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word128 -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word128 -> r # gmapQ :: (forall d. Data d => d -> u) -> Word128 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word128 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word128 -> m Word128 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word128 -> m Word128 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word128 -> m Word128 # | |
Generic Word128 Source # | |
Read Word128 Source # | |
Show Word128 Source # | |
Eq Word128 Source # | |
Ord Word128 Source # | |
Defined in Data.LargeHashable.LargeWord | |
type Rep Word128 Source # | |
Defined in Data.LargeHashable.LargeWord type Rep Word128 = D1 ('MetaData "Word128" "Data.LargeHashable.LargeWord" "large-hashable-0.1.1.0-FnYsWabf22GKIEaudEP0If" 'False) (C1 ('MetaCons "Word128" 'PrefixI 'True) (S1 ('MetaSel ('Just "w128_first") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "w128_second") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))) |
Word256 | |
|
Instances
Data Word256 Source # | |
Defined in Data.LargeHashable.LargeWord gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word256 -> c Word256 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word256 # toConstr :: Word256 -> Constr # dataTypeOf :: Word256 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word256) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word256) # gmapT :: (forall b. Data b => b -> b) -> Word256 -> Word256 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word256 -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word256 -> r # gmapQ :: (forall d. Data d => d -> u) -> Word256 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word256 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word256 -> m Word256 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word256 -> m Word256 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word256 -> m Word256 # | |
Generic Word256 Source # | |
Read Word256 Source # | |
Show Word256 Source # | |
Eq Word256 Source # | |
Ord Word256 Source # | |
Defined in Data.LargeHashable.LargeWord | |
type Rep Word256 Source # | |
Defined in Data.LargeHashable.LargeWord type Rep Word256 = D1 ('MetaData "Word256" "Data.LargeHashable.LargeWord" "large-hashable-0.1.1.0-FnYsWabf22GKIEaudEP0If" 'False) (C1 ('MetaCons "Word256" 'PrefixI 'True) (S1 ('MetaSel ('Just "w256_first") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word128) :*: S1 ('MetaSel ('Just "w256_second") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word128))) |
bsToW128 :: ByteString -> Word128 Source #
Converts a ByteString
into a Word128
. Only the first 16 bytes
are taken into account, the rest is ignored.
w128ToBs :: Word128 -> ByteString Source #
bsToW256 :: ByteString -> Word256 Source #
Converts a ByteString
into a Word256
. Only the first 32 bytes
are taken into account, the rest is ignored.
w256ToBs :: Word256 -> ByteString Source #