hnix-store-core-0.8.0.0: Core types used for interacting with the Nix store.
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.Nix.Hash.Truncation

Synopsis

Documentation

truncateInNixWay :: Int -> ByteString -> ByteString Source #

Bytewise truncation of a Digest.

When truncation length is greater than the length of the bytestring but less than twice the bytestring length, truncation splits the bytestring into a head part (truncation length) and tail part (leftover part), right-pads the leftovers with 0 to the truncation length, and combines the two strings bytewise with xor.