Copyright | 2019 Monadic GmbH |
---|---|
License | BSD3 |
Maintainer | kim@monadic.xyz, alfredo@monadic.xyz, team@monadic.xyz |
Stability | provisional |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
multibase encoding of strict ByteString
s.
Synopsis
- data Base (a :: Symbol) where
- BaseIdentity :: Base "id"
- Base2 :: Base "2"
- Base16 :: Base "16"
- Base64 :: Base "64"
- Base16upper :: Base "16u"
- Base32hex :: Base "32x"
- Base32hexupper :: Base "32xu"
- Base32hexpad :: Base "32xp"
- Base32hexpadupper :: Base "32xpu"
- Base32 :: Base "32"
- Base32z :: Base "32z"
- Base32upper :: Base "32u"
- Base32pad :: Base "32p"
- Base32padupper :: Base "32pu"
- Base58flickr :: Base "58flickr"
- Base58btc :: Base "58btc"
- Base64pad :: Base "64p"
- Base64url :: Base "64url"
- Base64urlpad :: Base "64urlp"
- class ValidBase b => ToCode b
- data Multibase
- fromMultibase :: Multibase -> ByteString
- encodedBytes :: Multibase -> ByteString
- encode :: ToCode b => AtBase b -> Multibase
- decode :: ByteString -> Either String ByteString
- data CompactMultibase
- compact :: Multibase -> CompactMultibase
- expand :: CompactMultibase -> Multibase
Supported bases
data Base (a :: Symbol) where Source #
Supported bases.
BaseIdentity :: Base "id" | |
Base2 :: Base "2" | |
Base16 :: Base "16" | |
Base64 :: Base "64" | |
Base16upper :: Base "16u" | hexadecimal, uppercase alphabet |
Base32hex :: Base "32x" | RFC4648 no padding - highest char |
Base32hexupper :: Base "32xu" | RFC4648 no padding - highest char, uppercase alphabet |
Base32hexpad :: Base "32xp" | RFC4648 with padding |
Base32hexpadupper :: Base "32xpu" | RFC4648 with padding, uppercase alphabet |
Base32 :: Base "32" | RFC4648 no padding |
Base32z :: Base "32z" | z-base-32 (used by Tahoe-LAFS) |
Base32upper :: Base "32u" | RFC4648 no padding, uppercase alphabet |
Base32pad :: Base "32p" | RFC4648 with padding |
Base32padupper :: Base "32pu" | RFC4648 with padding, uppercase alphabet |
Base58flickr :: Base "58flickr" | base58 flickr alphabet |
Base58btc :: Base "58btc" | base58 bitcoint alphabet |
Base64pad :: Base "64p" | RFC4648 with padding (MIME-encoding) |
Base64url :: Base "64url" | RFC4648 no padding |
Base64urlpad :: Base "64urlp" | RFC4648 with padding |
class ValidBase b => ToCode b Source #
Symbols for which a multibase code is defined and supported by this library
toCode
Instances
Multibase encoding and decoding
A multibase-encoded strict ByteString
.
fromMultibase :: Multibase -> ByteString Source #
encodedBytes :: Multibase -> ByteString Source #
decode :: ByteString -> Either String ByteString Source #
Decode a strict ByteString
, assumed to be Multibase
-encoded.
Compact represenation
data CompactMultibase Source #
A 'Multibase backed by a ShortByteString
.
This is useful when holding many Multibase
values in memory, due to lower
memory overhead and less heap fragmentation. See the documentation for
ShortByteString
for details.
Instances
Eq CompactMultibase Source # | |
Defined in Data.ByteString.Multibase (==) :: CompactMultibase -> CompactMultibase -> Bool # (/=) :: CompactMultibase -> CompactMultibase -> Bool # | |
Ord CompactMultibase Source # | |
Defined in Data.ByteString.Multibase compare :: CompactMultibase -> CompactMultibase -> Ordering # (<) :: CompactMultibase -> CompactMultibase -> Bool # (<=) :: CompactMultibase -> CompactMultibase -> Bool # (>) :: CompactMultibase -> CompactMultibase -> Bool # (>=) :: CompactMultibase -> CompactMultibase -> Bool # max :: CompactMultibase -> CompactMultibase -> CompactMultibase # min :: CompactMultibase -> CompactMultibase -> CompactMultibase # | |
Hashable CompactMultibase Source # | |
Defined in Data.ByteString.Multibase hashWithSalt :: Int -> CompactMultibase -> Int # hash :: CompactMultibase -> Int # | |
NFData CompactMultibase Source # | |
Defined in Data.ByteString.Multibase rnf :: CompactMultibase -> () # |
compact :: Multibase -> CompactMultibase Source #
O(n). Convert a Multibase
encoding to a compact representation.
Involves copying the underlying ByteString
.
expand :: CompactMultibase -> Multibase Source #
O(n). Convert from the compact to the regular representation.
Involves copying the underlying ShortByteString
.