sha256h2

SHA256 Hash Part 2 (A32)

SHA256H2.32 <Qd>, <Qn>, <Qm>

SHA256 hash update (part 2).

Details

SHA256 Hash Part 2 performs the second half of a SHA256 hash update operation on 128-bit NEON registers, processing the W array and final hash update. Qd receives the final hash state; Qn provides the hash value from the previous SHA256H instruction; Qm provides the input data block words. This A32 Crypto extension instruction does not update condition flags and requires NEON support.

Pseudocode Operation

hash_state ← Qd;
w_data ← Qn;
data_words ← Qm;
temp ← SHA256_CH(hash_state.word[0], hash_state.word[1], hash_state.word[2]);
temp ← temp + SHA256_SUM1(hash_state.word[0]);
temp ← temp + data_words;
Qd.word[1] ← Qd.word[1] + temp;
Qd.word[0] ← hash_state.word[3];

Example

SHA256H2.32 q0, q1, q2

Encoding

Binary Layout
11110011
0
0
0
Vn
Vd
1100
N
Q
M
1
Vm
 
Format Crypto 3-Reg
Opcode 0xF3100C00
Extension Crypto

Operands

  • Qd
    State
  • Qn
    Hash
  • Qm
    Data

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x5E005000 SHA256H2 <Qd>, <Qn>, <Vm>.4S A64 01011110 | 00 | 0 | Rm | 010 | 1 | 00 | Rn | Rd

Description

SHA256 hash update (part 2).

Operation

AArch64.CheckFPAdvSIMDEnabled();

bits(128) result;
result = SHA256hash(V[n, 128], V[d, 128], V[m, 128], FALSE);
V[d, 128] = result;