File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
hnix-store-core/src/System/Nix/Internal Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ digits32 = Vector.fromList "0123456789abcdfghijklmnpqrsvwxyz"
2222
2323-- | Encode a 'BS.ByteString' in Nix's base32 encoding
2424encode :: ByteString -> Text
25- encode c = Data.Text. pack $ fmap char32 [nChar - 1 , nChar - 2 .. 0 ]
25+ encode c = Data.Text. pack $ takeCharPosFromDict <$> [nChar - 1 , nChar - 2 .. 0 ]
2626 where
2727 -- Each base32 character gives us 5 bits of information, while
2828 -- each byte gives is 8. Because 'div' rounds down, we need to add
@@ -43,8 +43,8 @@ encode c = Data.Text.pack $ fmap char32 [nChar - 1, nChar - 2 .. 0]
4343 [ fromIntegral (byte j) * (256 ^ j)
4444 | j <- [0 .. Bytes. length c - 1 ] ]
4545
46- char32 :: Integer -> Char
47- char32 i = digits32 Vector. ! digitInd
46+ takeCharPosFromDict :: Integer -> Char
47+ takeCharPosFromDict i = digits32 Vector. ! digitInd
4848 where
4949 digitInd =
5050 fromIntegral $
You can’t perform that action at this time.
0 commit comments