| 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 |
Data.ByteString.Multibase
Description
multibase encoding of strict ByteStrings.
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.
Constructors
| 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
Minimal complete definition
toCode
Instances
Multibase encoding and decoding
A multibase-encoded strict ByteString.
Instances
| Eq Multibase Source # | |
| Ord Multibase Source # | |
| Hashable Multibase Source # | |
Defined in Data.ByteString.Multibase | |
| NFData Multibase Source # | |
Defined in Data.ByteString.Multibase | |
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 Methods (==) :: CompactMultibase -> CompactMultibase -> Bool # (/=) :: CompactMultibase -> CompactMultibase -> Bool # | |
| Ord CompactMultibase Source # | |
Defined in Data.ByteString.Multibase Methods 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 | |
| NFData CompactMultibase Source # | |
Defined in Data.ByteString.Multibase Methods 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.