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.