commit 94e9e1ea968a43ec7f1e0f7e85bd9d7a7efc6164
parent cf36fcd69d8fcfb0dc49b9237abbb13e69ffd329
Author: Jared Tobin <jared@jtobin.io>
Date: Fri, 27 Dec 2024 19:41:46 -0330
lib: unsafe index
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/Data/ByteString/Base58.hs b/lib/Data/ByteString/Base58.hs
@@ -19,6 +19,7 @@ import Control.Monad (guard)
import qualified Data.Bits as B
import Data.Bits ((.|.))
import qualified Data.ByteString as BS
+import qualified Data.ByteString.Unsafe as BU
fi :: (Integral a, Num b) => a -> b
fi = fromIntegral
@@ -86,7 +87,7 @@ unroll_base58 = BS.reverse . BS.unfoldr coalg where
| a == 0 = Nothing
| otherwise = Just $
let (b, c) = quotRem a 58
- in (BS.index base58_charset (fi c), b)
+ in (BU.unsafeIndex base58_charset (fi c), b)
-- from base58
roll_base58 :: BS.ByteString -> Integer