title: SHA-256 Padding
body: <p>To calculate the SHA-256 hash I need to pad my message. Am using the following description:
  (taken from <a href="http://csrc.nist.gov/groups/STM/cavp/documents/shs/sha256-384-512.pdf" rel="nofollow">http://csrc.nist.gov/groups/STM/cavp/documents/shs/sha256-384-512.pdf</a>)</p>
  
  <blockquote>
    <p>Pad the message in the usual way: Suppose the length of the message M,
    in bits, is l. Append the bit "1" to the end of the message, and then
    k zero bits, where k is the smallest non-negative solution to the
    equation l+1+k  448 mod 512. To this append the 64-bit block which is
    equal to the number l written in binary</p>
  </blockquote>
  
  <p>But what should one do if the message length in bits is less than 64-bits short of a 512bit block... i.e., there isn't room for the end 64-bit block mentioned above? Or the 64-bit length and the "1" bit?</p>
  
  <p>I had a look on wikipedia too, but this doesn't throw any more light on the subject. Google searches haven't been too fruitful either, would appreciate any suggestions :)</p>
  
  <p>Thanks</p>