File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -240,6 +240,13 @@ func (ba *BitArray) BitAt(off int) byte {
240240// single byte 0xf0. In order to prevent these from being mapped to the same
241241// hash value, the hash is calculated after appending a 3 bits marker
242242// indicating the number of padding LSBs at the end of the original bit array.
243+ //
244+ // Deprecated: Most hash functions can handle bit-oriented messages as-is by
245+ // design, and it is not appropriate to use the byte-oriented standard hash.Hash
246+ // with padding bits. The result does not comply with the specifications. Not
247+ // all hash functions are available, but for SHA-1 and SHA-2, which can handle
248+ // bit-oriented messages correctly, dedicated methods such as SHA512, SHA256,
249+ // and SHA1 are now available. It is better to use them instead.
243250func (ba * BitArray ) Hash (h hash.Hash ) []byte {
244251 b , _ := ba .MarshalBinary ()
245252 h .Write (b )
You can’t perform that action at this time.
0 commit comments