SHA256 (SHA in general) has a precise behavior if you wanna hash a number of bits not multiple of the block (512bit) Sha256.go handle this correcty ONLY in the case that you input is at least multiple of 8 bits. If you wanna hash, say, 20bit (0xABCDE) you cannot obtain a correct result. Note that Sha256(0xABCDE) is (See FIPS and NIST publications) not the same of Sha256 of 0x0ABCDE o 0xABCDE0. Any idea or any implementation available on the web? A .Write(data []byte, effectciveLenInBits int) would be required, while today Write([]byte) assumes that each bit of the last byte is meaningful and to be hashed
Thanks, Paolo -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.