Datasheet
If the size of the last block of data is less than or equal to 55 bytes, no additional 64-byte block is
required. However, if the last block of data contains more than 55 bytes, an extra 64-byte block
must be added to make the padding as specified by FIPS 180-1. This extra block is added
automatically by the hardware; thus, the module is fed with a 64-byte block of data. However,
appending a pad on the last block of data can result in the creation of an extra 64-byte block.
The one or two last blocks that contain the padding are processed in the same way as the other
blocks. Hash completion is then indicated in the same way as for a new hash, and the hash result
can be read in the digest registers. The SHA_DIGESTCOUNT register returns restored Digest
Count + Length when it is read, and hashing completes.
Assuming a message of 129 bytes, Table 15-5 on page 1051 shows the SHA digest for three passes.
Table 15-6 on page 1051 shows the SHA digest for one pass.
Table 15-5. SHA Digest Processed in Three Passes
SHA_DATA_n_INSHA_MODE and SHA_LENGTHSHA_DIGESTCOUNTDigest (A to E)
First 64 bytes of
message
WRITE:
LENGTH=64
ALGO (dependent on the algorithm to
apply)
ALGO_CONSTANT=1
CLOSE_HASH=0
First pass
Second 64 bytes of
message
WRITE:
LENGTH=64
ALGO (dependent on the algorithm to
apply)
ALGO_CONSTANT=0
CLOSE_HASH=0
WRITE: 64Round 1 digest
calculation
Second pass
Last byte of messageWrite:
LENGTH=1
ALGO (dependent on the algorithm to
apply)
ALGO_CONSTANT=0
CLOSE_HASH=1
WRITE: 128Round 2 digest
calculation
Third pass
READ: 129Final digest
If the three passes are not performed in succession, the digest registers must be saved and restored
for the next use of the SHA/MD5 engine. If the rounds are performed consecutively, there is no
need to do anything with the digest registers.
Table 15-6. SHA Digest Processed in One Pass
SHA_DATA_n_INSHA_MODE and
SHA_LENGTH
SHA_DIGEST_COUNTDigest (A to E)
First 64 bytes of messageWRITE:
LENGTH=129
ALGO (dependent on the
algorithm to apply)
ALGO_CONSTANT=1
CLOSE_HASH=1
First
pass
1051June 18, 2014
Texas Instruments-Production Data
Tiva
™
TM4C129ENCPDT Microcontroller