Home/Instructions/SHA256 Sum1
SHA256SUM1

RISC-V SHA256SUM1 Instruction Details

Instruction ManualI-type

SHA-256 Σ1 function (uppercase): ROTR(rs1,6) ^ ROTR(rs1,11) ^ ROTR(rs1,25)

Instruction Syntax

sha256sum1 rd, rs1
Operand Breakdown
Destination rd: general-purpose register receiving the result.
Source rs1: register holding the first operand.
Immediate imm: 12-bit signed value, sign-extended before operation with rs1.
ZknhCrypto & Security

Instruction Behavior

sha256sum1 implements the SHA-256 compression Σ1 function: Σ1(x) = ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25). It is defined for RV32/RV64: RV32 operates on all of X(rs1), while RV64 uses X(rs1)[31:0] and sign-extends the 32-bit result before writing rd.

SHA256SUM1 Decode And Execute Animation

Bounded teaching inputs execute the official SHA-256 fixed-width bit operations; this does not model a complete algorithm or microarchitecture.

rd
rs1
sha256sum1
,

SHA256SUM1 is defined in RV32/RV64; RV64 uses X(rs1)[31:0] and sign-extends the 32-bit result to XLEN.

fixed selector
source
fixed
destination
OP-IMM
31..20
000100000001
19..15
rs1=x11
14..12
001
11..7
rd=x10
6..0
0010011
Execution Data Path
inb
0x89ABCDEF
ror32(inb, 6)
0xBE26AF37
ror32(inb, 11)
0xBDF13579
ror32(inb, 25)
0xD5E6F7C4
result
0xD6316D8A
Architectural Result
a0(x10) = 0xD6316D8A

This animation shows only official ISA fields and architectural state; it does not model a complete hash algorithm, pipeline, cache, or timing implementation.

Quick Understanding & Search Notes

SHA256SUM1 is a Zknh scalar cryptography instruction for SHA-256 transform. This page is checked against the official scalar crypto extension, avoiding confusion among round functions, key schedule steps, and operand sources.

sha256sum1 performs the SHA-256 uppercase Sigma compression transform using the official fixed rotate-right combination.
Scalar crypto instructions use integer X registers, and the official spec requires the relevant crypto instructions to be implemented with data-independent execution latency.

Common Usage Scenarios

Crypto & Security

Understand this scenario with real code like «sha256sum1 a0, a1».

Hash Algorithms

Understand this scenario with real code like «sha256sum1 a0, a1».

Pre-Use Checklist

Syntax Check
  • Verify the immediate field is within the valid range.
  • Confirm source register rs1 points to the correct operand.
Semantic Check
  • Check if the immediate sign-extension matches expectations.
  • Ensure the result register rd has a clear purpose.

Pitfalls / Common Confusions

Σ1 (sum1, uppercase) for compression; σ1 (sig1, lowercase) for message schedule.

FAQ

Does SHA256SUM1 use floating-point or vector registers?

No. These scalar crypto extension instructions use integer X registers.

Is SHA256SUM1 a complete algorithm implementation?

No. It implements one SHA-2 Sigma transform; software still schedules the remaining SHA-2 computation.