8.3.4.9 Context Save and Restore

The SHA supports interrupting a multi-block hash computation, saving the internal state, and resuming it later. The final digest is identical to computing the entire message without interruption.

To save the internal state after processing K blocks, read SHA_IODATARx. The number of words to read depends on the algorithm: 5 for SHA1, 8 for SHA224/SHA256, 16 for SHA384/SHA512/SHA512-derivatives

To restore the state and resume, perform a software reset, configure SHA_MR with UIHV=1, set SHA_MSR to the full message size and SHA_BCR to the remaining bytes, write the saved state into UIHV0 (via SHA_CR.WUIHV), set FIRST, then continue feeding the remaining blocks.