README.md (2305B)
1 # base16 2 3 [](https://hackage.haskell.org/package/ppad-base16) 4  5 [](https://docs.ppad.tech/base16) 6 7 Pure base16 encoding & decoding on strict ByteStrings. 8 9 ## Usage 10 11 A sample GHCi session: 12 13 ``` 14 > :set -XOverloadedStrings 15 > 16 > -- import qualified 17 > import qualified Data.ByteString.Base16 as B16 18 > 19 > -- simple base16 encoding and decoding 20 > B16.encode "hello world" 21 "68656c6c6f20776f726c64" 22 > 23 > B16.decode "68656c6c6f20776f726c64" 24 Just "hello world" 25 ``` 26 27 ## Documentation 28 29 Haddocks (API documentation, etc.) are hosted at 30 [docs.ppad.tech/base16](https://docs.ppad.tech/base16). 31 32 ## Performance 33 34 The aim is best-in-class performance for pure, highly-auditable Haskell 35 code. We could go slightly faster by using direct allocation and writes, 36 but we get pretty close to the best impure versions with only builders. 37 38 Current benchmark figures on 1kb inputs on a relatively-beefy NixOS VPS look 39 like (use `cabal bench` to run the benchmark suite): 40 41 ``` 42 benchmarking encode/ppad-base16 43 time 7.634 μs (7.543 μs .. 7.749 μs) 44 0.999 R² (0.998 R² .. 0.999 R²) 45 mean 7.693 μs (7.622 μs .. 7.768 μs) 46 std dev 240.6 ns (196.5 ns .. 324.8 ns) 47 48 benchmarking ppad-base16 49 time 1.893 μs (1.871 μs .. 1.919 μs) 50 0.998 R² (0.998 R² .. 0.999 R²) 51 mean 1.897 μs (1.871 μs .. 1.924 μs) 52 std dev 91.64 ns (74.26 ns .. 118.2 ns) 53 ``` 54 55 ## Security 56 57 This library aims at the maximum security achievable in a 58 garbage-collected language under an optimizing compiler such as GHC, in 59 which strict constant-timeness can be challenging to achieve. 60 61 If you discover any vulnerabilities, please disclose them via 62 security@ppad.tech. 63 64 ## Development 65 66 You'll require [Nix][nixos] with [flake][flake] support enabled. Enter a 67 development shell with: 68 69 ``` 70 $ nix develop 71 ``` 72 73 Then do e.g.: 74 75 ``` 76 $ cabal repl ppad-base16 77 ``` 78 79 to get a REPL for the main library. 80 81 [nixos]: https://nixos.org/ 82 [flake]: https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake.html