base91 alternatives and similar packages
Based on the "Codec" category.
Alternatively, view base91 alternatives based on common mentions on social networks and blogs.
-
binary-serialise-cbor
Binary serialisation in the CBOR format -
multihash-serialise
Haskell libraries for interacting with IPFS -
postgresql-binary
Encoders and decoders for the PostgreSQL's binary format -
HCodecs
A library to read, write and manipulate MIDI, WAVE, and SoundFont2 files -
html-entities
A codec library for HTML-escaped text and HTML-entities -
friday-juicypixels
Convert between friday and juicypixels types -
hs-zstd
Bindings to the Zstandard library to make it usable from the Haskell programming language. -
activitystreams-aeson
Basic library for working with Activity Streams -
libvorbis
Haskell binding for libvorbis, for decoding Ogg Vorbis audio files -
threefish
Haskell implementation of the Threefish block cipher and the Skein hash function built on it. -
logic-TPTP
Import, export etc. for TPTP, a syntax for first-order logic -
streaming-brotli
Streaming interface for Brotli (RFC7932) compression -
iteratee-compress
Enumerators for compressing and decompressing streams
Clean code begins in your IDE with SonarLint
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of base91 or a related project?
README
base91
A Base91 Encoder & Decoder for Haskell, written by Alvaro J. Genial.
Synopsis
This library (and command-line utility) implement generic bidirectional Base91 encoding & decoding following the specification.
Status
The codebase should be considered stable; it is documented using haddock
and tested using QuickCheck
.
Description
Base91 is a scheme that allows arbitrary binary data (a sequence of 8-bit bytes, or octets) to be represented using an alphabet consisting of 91 of the 95 printable ASCII characters. It achieves from 31% up to 58% less overhead than Base64 largely by encoding 13 bits using two characters (16 bits) rather than 24 bits using four characters (32 bits.)
Alphabet
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '!', '#', '$',
'%', '&', '(', ')', '*', '+', ',', '.', '/', ':', ';', '<', '=',
'>', '?', '@', '[', ']', '^', '_', '`', '{', '|', '}', '~', '"'
Library
The base91 package exposes a single generic Codec.Binary.Base91
module with two functions, the duals of each other:
encode
: Encodes a byte (Word8
) input sequence (e.g.[Word8]
,ByteString
, etc.) to a character (Char
) output sequence (e.g.[Char]
,Data.Text
, etc.).decode
: Decodes a character (Char
) input sequence (e.g.[Char]
,Data.Text
, etc.) to a byte (Word8
) output sequence (e.g.[Word8]
,ByteString
, etc.).
(Note that because the functions' signatures are generic, in some cases an explicit output type must be provided; see the example.)
Example
$ ghci Codec.Binary.Base91
λ let bytes = [72,101,108,108,111,44,32,119,111,114,108,100,33,10]
λ encode bytes :: String -- equal to "Hello, World!\n"
">OwJh>}A\"[email protected]@Y?FF"
λ decode ">OwJh>}A\"[email protected]@Y?FF" :: [Word8]
[72,101,108,108,111,44,32,119,111,114,108,100,33,10]
Utility
$ echo "Hello, World!" | base91 --encode
>OwJh>}AQ;[email protected]@Y?FF
$ echo ">OwJh>}AQ;[email protected]@Y?FF" | base91 --decode
Hello, World!
Usage
import System.Environment (getProgName)
import qualified Codec.Binary.Base91 as Base91
import qualified Data.ByteString as BS
import qualified Data.Text.IO as T
main :: IO ()
main = getProgName >>= \name -> case name of
"b91enc" -> BS.getContents >>= T.putStrLn . Base91.encode
"b91dec" -> T.getContents >>= BS.putStr . Base91.decode
_ -> error "invalid program name"
Documentation
The latest documentation can be found on Hackage.
Dependencies
The library's only requirements are the base
and mono-traversable
packages, the latter to permit abstracting over monomorphic containters; the command line utility requires bytestring
and text
as well for I/O. Testing requires all the aforementioned plus the QuickCheck
package. (See [base91.cabal](./base91.cabal) for details.)
License
This library is distributed under the MIT [LICENSE](./LICENSE.md).
*Note that all licence references and agreements mentioned in the base91 README section above
are relevant to that project's source code only.