pub fn sm3p0(x: u32) -> u32
🔬This is a nightly-only experimental API. (
Available on RISC-V RV64 and target feature
P0 transformation function as is used in the SM3 hash algorithm
This function is included in
Zksh extension. It’s defined as:
P0(X) = X ⊕ (X ≪ 9) ⊕ (X ≪ 17)
⊕ represents 32-bit xor, and
≪ k represents rotate left by
In the SM3 algorithm, the
P0 transformation is used as
E ← P0(TT2) when the
CF uses the intermediate value
TT2 to calculate
E in one iteration for subsequent processes.
According to RISC-V Cryptography Extensions, Volume I, the execution latency of this instruction must always be independent from the data it operates on.