Or, in general, any arbitrary number or bits that is not a multiple of 8.
According to hashlib.py there is one constructor method named for SHA256. Then I use sha256() to create a SHA256 hash object. I can now feed this object with arbitrary strings using the update() method, and at any point I can ask it for the digest of the concatenation of the strings fed to it so far using the digest() or hexdigest() methods.
Well. I would like to feed 1 bit to SHA256 in line with this link "What is the SHA-256 hash of a single '1' bit?"
In Python 2.7, of course.
So, what is the procedure to hash 1-bit long input consisting of the bit "1"? (not the 8-bit long byte[] { 1 } input)?
SHA*FinalBits(...). [1]: tools.ietf.org/html/rfc4634#section-8 [2]: tools.ietf.org/html/rfc4634