Skip to content

Commit 0fe7ff5

Browse files
committed
Weird bit fiddling to make printHashBytes32 work
1 parent 440dfeb commit 0fe7ff5

File tree

1 file changed

+1
-1
lines changed
  • hnix-store-core/src/System/Nix/Internal

1 file changed

+1
-1
lines changed

hnix-store-core/src/System/Nix/Internal/Hash.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ printHashBytes32 :: BS.ByteString -> T.Text
126126
printHashBytes32 c = T.pack $ concatMap char32 [nChar - 1, nChar - 2 .. 0]
127127
where
128128
-- The base32 encoding is 8/5's as long as the base256 digest
129-
nChar = fromIntegral $ BS.length c * 8 `div` 5
129+
nChar = fromIntegral $ ((BS.length c * 8 - 1) `div` 5) + 1
130130

131131
char32 :: Integer -> [Char]
132132
char32 i = [digits32 V.! digitInd]

0 commit comments

Comments
 (0)