![Texas Instruments SimpleLink Ethernet MSP432E401Y Technical Reference Manual Download Page 1593](http://html1.mh-extra.com/html/texas-instruments/simplelink-ethernet-msp432e401y/simplelink-ethernet-msp432e401y_technical-reference-manual_10955781593.webp)
SHA/MD5 Functional Description
1593
SLAU723A – October 2017 – Revised October 2018
Copyright © 2017–2018, Texas Instruments Incorporated
SHA/MD5 Accelerator
Table 25-5. SHA Digest Processed in Three Passes (continued)
Digest (A to E)
SHA_
DIGEST_COUNT
SHA_MODE and SHA_LENGTH
SHA_DATA_n_IN
Second pass
Round 1 digest
calculation
Write: 64
WRITE:
LENGTH =64
ALGO (dependent on the algorithm to apply)
ALGO_CONSTANT = 0
CLOSE_HASH = 0
Second 64 bytes of
message
Third pass
Round 2 digest
calculation
Write: 128
Write:
LENGTH = 1
ALGO (dependent on the algorithm to apply)
ALGO_CONSTANT = 0
CLOSE_HASH = 1
Last byte of
message
–
Final digest
Read: 129
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 25-6. SHA Digest Processed in One Pass
Digest (A to E)
SHA_
DIGEST_COUNT
SHA_MODE and SHA_LENGTH
SHA_DATA_n_IN
First pass
WRITE:
LENGTH = 129
ALGO (dependent on the algorithm to apply)
ALGO_CONSTANT = 1
CLOSE_HASH = 1
First 64 bytes of
message
Round 1 digest
calculation
Second 64 bytes
of message
Round 2 digest
calculation
Last byte of
message
Final digest
Read: 129
25.1.5.2 MD5 Mode
25.1.5.2.1 Starting a New Hash
To start a new hash, perform the following steps:
1. Set the ALGO bit field in the SHA_MODE register to 0x0 to select the MD5 algorithm.
2. Set the ALGO_CONSTANT bit to 1 in the SHA_MODE register to initialize all digest registers from
SHA_ODIGEST_A and SHA_IDIGEST_A to SHA_ODIGEST_H and SHA_IDIGEST_H with default
values specified by the algorithm, and set the SHA_DIGESTCOUNT register to 0.
3. Specify the LENGTH field in the SHA_LENGTH register of the hash data to process in bytes.
4. Set the CLOSE_HASH bit in the SHA_MODE register to let the SHA/MD5 engine do the padding. If
MD5 is computed in one shot, the length of the message can be any value up to. To process an
intermediate MD5 digest, the CLOSE_HASH bit is set to 0, in which case packets to be hashed must
be 64 bytes; the last packet must be hashed with the CLOSE_HASH bit set to 1.
After the configuration is complete, the hash engine can receive the data to process (the INPUT_READY
bit is 1 in the SHA_IRQSTATUS register). Data must be written to the 16 x 32-bit SHA_DATA_n_IN
registers that provide storage for one 64-byte block of data. Unless the CLOSE_HASH bit is set in the
SHA_MODE register, the SHA_DATA_n_IN 64-byte input buffer must be filled. Data can be written by
single write transactions to the 16 registers from a processor or by a µDMA transfer.
For a µDMA transfer, the SDAM_EN bit must be set in the SHA_SYSCONFIG register before starting the
new hash and the µDMA channel for SHA/MD5 0 Data In Request must be configured. The µDMA must
be configured to the appropriate hash transfer size. See
for more information on programming
the µDMA. A µDMA done is asserted after the last SHA_DATA_n_IN register is filled.