README.md (2353B)
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 ppad-base16 43 time 2.997 μs (2.988 μs .. 3.009 μs) 44 1.000 R² (1.000 R² .. 1.000 R²) 45 mean 3.024 μs (3.012 μs .. 3.035 μs) 46 std dev 39.14 ns (36.12 ns .. 42.87 ns) 47 variance introduced by outliers: 11% (moderately inflated) 48 49 benchmarking ppad-base16 50 time 599.0 ns (597.3 ns .. 601.3 ns) 51 1.000 R² (1.000 R² .. 1.000 R²) 52 mean 597.3 ns (596.3 ns .. 598.5 ns) 53 std dev 3.493 ns (2.623 ns .. 5.111 ns) 54 ``` 55 56 ## Security 57 58 This library aims at the maximum security achievable in a 59 garbage-collected language under an optimizing compiler such as GHC, in 60 which strict constant-timeness can be challenging to achieve. 61 62 If you discover any vulnerabilities, please disclose them via 63 security@ppad.tech. 64 65 ## Development 66 67 You'll require [Nix][nixos] with [flake][flake] support enabled. Enter a 68 development shell with: 69 70 ``` 71 $ nix develop 72 ``` 73 74 Then do e.g.: 75 76 ``` 77 $ cabal repl ppad-base16 78 ``` 79 80 to get a REPL for the main library. 81 82 [nixos]: https://nixos.org/ 83 [flake]: https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake.html