title: Python: get sha256() hash digest of a single bit in Python
body: <p>Or, in general, any arbitrary number or bits that is not a multiple of 8.</p>
  
  <p>According to <a href="https://docs.python.org/2/library/hashlib.html" rel="nofollow noreferrer">hashlib.py</a> 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.</p>
  
  <p>Well. I would like to feed 1 bit to SHA256 in line with this link <a href="https://stackoverflow.com/questions/4422970/what-is-the-sha-256-hash-of-a-single-1-bit">"What is the SHA-256 hash of a single '1' bit?"</a></p>
  
  <p>In Python 2.7, of course. </p>
  
  <p>So, what is the procedure to hash 1-bit long input consisting of the bit "1"? (not the 8-bit long byte[] { 1 } input)?</p>