Copyright | (c) 2012 Deian Stefan |
---|---|
License | BSD-style |
Maintainer | deian@cs.stanford.edu |
Stability | experimental |
Portability | GHC |
Safe Haskell | Trustworthy |
Language | Haskell98 |
Fast and efficient encoding and decoding of base64url-encoded strings.
Synopsis
- encode :: ByteString -> ByteString
- decode :: ByteString -> Either String ByteString
- decodeLenient :: ByteString -> ByteString
- joinWith :: ByteString -> Int -> ByteString -> ByteString
Documentation
encode :: ByteString -> ByteString Source #
Encode a string into base64url form. The result will always be a multiple of 4 bytes in length.
decode :: ByteString -> Either String ByteString Source #
Decode a base64url-encoded string. This function strictly follows the specification in RFC 4648.
decodeLenient :: ByteString -> ByteString Source #
Decode a base64url-encoded string. This function is lenient in following the specification from RFC 4648, and will not generate parse errors no matter how poor its input.
:: ByteString | String to intersperse and end with |
-> Int | Interval at which to intersperse, in bytes |
-> ByteString | String to transform |
-> ByteString |
Efficiently intersperse a terminator string into another at regular intervals, and terminate the input with it.
Examples:
joinWith "|" 2 "----" = "--|--|"
joinWith "\r\n" 3 "foobarbaz" = "foo\r\nbar\r\nbaz\r\n" joinWith "x" 3 "fo" = "fox"