US Secure Hash Algorithms (SHA and SHA-based HMAC and HKDF)

This document replaces RFC 4634, fixing errata and adding code for an HMAC-based extract-and-expand key derivation function. The United States of America has adopted a suite of secure hash algorithms (SHAs), including four beyond SHA-1, as part of a Federal Information Processing Standard (FIPS), specifically SHA-224, SHA-256, SHA-384, and SHA-512. This document makes open source code performing the SHA hash functions conveniently available to the Internet community. The sample code supports input strings of arbitrary bit length. Much of the text herein was adapted by the authors from FIPS 180-2. As with RFC 4634, code to perform SHA based HMACs is included and, new in this version, code for HKDF (RFC 5869) is included.