Home/Instructions/SHA256 Sigma1
SHA256SIG1

RISC-V SHA256SIG1 Instruction Details

Instruction ManualI-type

SHA-256 σ1 function: ROTR(rs1,17) ^ ROTR(rs1,19) ^ SHR(rs1,10)

Instruction Syntax

sha256sig1 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

sha256sig1 implements the SHA-256 σ1 function: σ1(x) = ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10). 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.

SHA256SIG1 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
sha256sig1
,

SHA256SIG1 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
000100000011
19..15
rs1=x11
14..12
001
11..7
rd=x10
6..0
0010011
Execution Data Path
inb
0x89ABCDEF
ror32(inb, 17)
0xE6F7C4D5
ror32(inb, 19)
0x79BDF135
inb >> 10
0x00226AF3
result
0x9F685F13
Architectural Result
a0(x10) = 0x9F685F13

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

SHA256SIG1 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.

sha256sig1 performs the SHA-256 lowercase sigma message-schedule transform using the official fixed rotate-right and logical-shift 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 «sha256sig1 a0, a1».

Hash Algorithms

Understand this scenario with real code like «sha256sig1 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

Distinguish from Σ1 (sha256sum1, uppercase sigma): σ1 for message schedule, Σ1 for compression.

FAQ

Does SHA256SIG1 use floating-point or vector registers?

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

Is SHA256SIG1 a complete algorithm implementation?

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