hnix-store-core-0.6.0.0: Core effects for interacting with the Nix store.
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.Nix.Internal.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.