pub fn sm3p0(x: u32) -> u32
🔬 This is a nightly-only experimental API. (stdsimd #48556)
Available on RISC-V RV64 only.
Expand description

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)

where represents 32-bit xor, and ≪ k represents rotate left by k bits.

In the SM3 algorithm, the P0 transformation is used as E ← P0(TT2) when the compression function CF uses the intermediate value TT2 to calculate the variable 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.