5.1.8.1 SHA - SHA256 Digest
The
SHA
command utilizes the SHA256 Hash algorithm for computing the
hash of a message. The primary input to the command is the actual message. The message
is submitted to the device in blocks of 1 to 64 bytes. The following procedure is used
when no context switching is required:- Issue the
SHA
command in Start mode. No message is included. - Issue the
SHA
command in Update mode with 1 to 64 bytes of the message. - Repeat step 2 until the total number of bytes of the message have been submitted.
- Issue the
SHA
command in End mode to complete the SHA256 calculation.
Opcode |
Mode |
Param2 |
Data | Description |
---|---|---|---|---|
0x47 | 0x00 | 0x00 00 | 0 bytes | Start mode |
0x01 | 0x00 [ByteCount] | 1 to 64 bytes | Update mode | |
0x02 | 0x00 [ByteCount] | 0 to 64 bytes |
Finalize mode: Digest placed in Output Buffer and TempKey | |
0x42 | 0x00 [ByteCount] | Finalize mode: Digest placed in Output Buffer and Message Digest Buffer | ||
0xC2 | 0x00 [ByteCount] | Finalize mode: Digest placed in Output Buffer only |
Name | Mode | Size | Description |
---|---|---|---|
Response | 0x00, 0x01 | 1 byte | 0x00 if successful, otherwise an error code is received |
0x02, 0x42, 0xC2 |
1 byte |
If error code |