ROS-Ethereum: A Convenient Tool to Bridge ROS and Blockchain (Ethereum)
Algorithm 2
The pseudocode of the SM4 cipher algorithm.
(i)
Input: the 128 bit plaintext and the round key array of 32 bits each
(ii)
Output: the 128 bit ciphertext
(iii)
Initialization: convert to an array of length 4, each element of size 32 bits
(iv)
Begin
(v)
word
(vi)
byte
(vii)
word
(viii)
For
(ix)
(x)
For
(xi)
(xii)
For
(xiii)
(xiv)
(xv)
(xvi)
For
(xvii)
End
(xviii)
SM2 KDF : KDF is the key derivation function used to derive key data from a shared secret bit string. The bitstring type is a bit string, and the integer type is an integer. The operation implies the operation of converting the type to a bit string for concatenation. is the smallest integer greater than or equal to , and is the largest integer less than or equal to . The variable is the shared secret bit string, and the variable is the length of derived key data. The variable is the output key data bit string of length . The function is the cryptographic hash function whose output is exactly bits in length. The pseudocode of KDF is shown in Algorithm 3.