You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- 2021-06-07: NOTE: ^ This is why all the cookery with DataKinds, trunkation length (if allowed arbitrary) needs to be represented in type.
205
-
-- 2021-06-07: NOTE: Renamed function, since truncation can be done in a lot of ways, there is no practice of truncting hashes this way, moreover: <https://crypto.stackexchange.com/questions/56337/strength-of-hash-obtained-by-xor-of-parts-of-sha3>
206
203
truncateDigestInNixWay (Digest c) =
207
-
Digest$BS.pack $fmap truncOutputByte [0.. n-1]
204
+
Digest$truncateInNixWay n c
208
205
where
209
206
n =fromIntegral$Kind.natVal $Proxy@n
210
-
211
-
truncOutputByte::Int->Word8
212
-
truncOutputByte i = foldl' (aux i) 0 [0..BS.length c -1]
0 commit comments