base64

RFC 4648-compliant padded and unpadded base64 and base64url encodings https://github.com/emilypi/base64

Version on this page:0.3.0.0
Stackage Nightly 2020-01-19:0.3.1.1
Latest on Hackage:0.3.1.1

See all snapshots base64 appears in

BSD-3-Clause licensed by Emily Pillmore
Maintained by emilypi@cohomolo.gy

Module documentation for 0.3.0.0

This version can be pinned in stack with:base64-0.3.0.0@sha256:989004d00f6da3b198758a9ebe31c5c227bdafe47dbf5abbbe0d5552f3e05338,2421

Base64

Build Status Hackage

Padded and unpadded base64 and base64url encodings for Text and ByteString values, along with their optics.

For the companion Prisms and pattern synonyms, see base64-lens.

Summary

What does this library provide? Here is the summary:

  • Better performance over existing Base64 libraries (2x and 3x for most use-cases - see PERFORMANCE.md)
  • Support for unpadded Base64 and Base64-url
  • Support for Text encodings and decodings
  • Optics for handling more complex structures with Base64 representations via the base64-lens package

There are no dependencies aside from base:

base64 dependencies

Motivation

Haskell has two main libraries for Base64: memory, and base64-bytestring.

Of these, memory is geared towards integration with other memory primitives in the library, without much of an eye towards performance, while base64-bytestring is built to exclusively address ByteString encoding and decoding, and is very performant. Many great strides have been made in the realm of Base64 performance and vectorization just in the past 5 years, which this library attempts to capture. Additionally, we attempt to fix perceived shortcomings with both APIs in the support of unpadded Base64 and Base64-url support (which memory provides, but not base64-bytestring), as well as supporting Text values (neither libraries provide).

Changes

Revision history for base64

0.3.0.0 – 2020-01-07

  • After a discussion with lexilambda, we’re making ‘encodeBase64’ be ByteString -> Text by default, offering ByteString -> ByteString as a secondary format.
  • Add decodeBase64Lenient to the API for phadej
  • Fix unpadded decoding bug where garbage was appended to the end of garbage inputs. A cleaner way to do this is to simply encode as Base64 with padding and then strip padding chars until I come up with a workflow specific to unpadded inputs (I used to have this, so I’ll have to dig it up)
  • Added isBase64 and isBase64Url to the API
  • Performance is stable

0.2.0.0 – 2020-01-05

  • After a discussion with phadej, we’re doing away with the flags, and splitting the optics out into their own separate library
  • Removed unnecessary inline pragmas

0.1.0.0 – 2020-01-05

  • Do away with the typeclasses, and just provide prisms + synonyms
  • Continued performance improvements to decoding
  • Corrected benchmarks

0.0.1.0 – 2020-01-03

  • First version. Released on an unsuspecting world.
  • Preliminary release
Depends on 4 packages(full list with versions):
Used by 1 package in nightly-2020-01-08(full list with versions):