ppad-base64-0.1.0: Fast base64 encoding and decoding on bytestrings.
Copyright(c) 2026 Jared Tobin
LicenseMIT
MaintainerJared Tobin <jared@ppad.tech>
Safe HaskellNone
LanguageHaskell2010

Data.ByteString.Base64

Description

Pure base64 encoding and decoding of strict bytestrings.

Synopsis

Documentation

encode :: ByteString -> ByteString Source #

Encode a base256 ByteString as base64.

Uses ARM NEON extensions when available, otherwise a pure Haskell scalar loop.

>>> encode "hello world"
"aGVsbG8gd29ybGQ="

decode :: ByteString -> Maybe ByteString Source #

Decode a base64 ByteString to base256.

Uses ARM NEON extensions when available, otherwise a pure Haskell scalar loop. Invalid inputs (including incorrectly- padded or non-canonical inputs) will produce Nothing.

>>> decode "aGVsbG8gd29ybGQ="
Just "hello world"
>>> decode "aGVsbG8gd29ybGQ" -- missing padding
Nothing