sha1m

SHA1 Majority

SHA1M <Qd>, <Sn>, <Vm>.<T>

SHA1 hash update (Majority function).

Details

Performs one round of SHA-1 hash computation using the Majority function. The instruction updates the SHA-1 state in Qd by processing the 32-bit hash value in Sn and 128-bit data from Vm. This is an AArch64-only instruction requiring the Crypto extension. No condition flags are affected.

Pseudocode Operation

T ← SHA1_Majority(Sn)
Qd ← SHA1_Update_M(Qd, T, Vm)

Example

SHA1M q0, s1, v2.4s.T

Encoding

Binary Layout
01011110
00
0
Rm
0
010
00
Rn
Rd
 
Format Crypto
Opcode 0x5E002000
Extension Crypto

Operands

  • Qd
    State
  • Sn
    Hash
  • Vm
    Data

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x5E002000 SHA1M <Qd>, <Sn>, <Vm>.4S A64 01011110 | 00 | 0 | Rm | 0 | 010 | 00 | Rn | Rd

Description

SHA1 hash update (majority).

Operation

AArch64.CheckFPAdvSIMDEnabled();

bits(128) x = V[d, 128];
bits(32) y = V[n, 32];    // Note: 32 not 128 bits wide
bits(128) w = V[m, 128];
bits(32) t;

for e = 0 to 3
    t = SHAmajority(x<63:32>, x<95:64>, x<127:96>);
    y = y + ROL(x<31:0>, 5) + t + Elem[w, e, 32];
    x<63:32> = ROL(x<63:32>, 30);
    <y, x> = ROL(y:x, 32);
V[d, 128] = x;