Research Article

ROS-Ethereum: A Convenient Tool to Bridge ROS and Blockchain (Ethereum)

Algorithm 1

The pseudocode of the SM4 key expansion algorithm.
(i)Input: the 128-bit initial key
(ii)listalistaOutput: the round key array of length 32, each element of size 32 bits
(iii)Initialization: convert to an array of length 4, each element of size 32 bits
(iv)Begin
(v)word
(vi)word
(vii)For
(viii)
(ix)For
(x)
(xi)End
(xii)SM4 cipher: The variable size of byte type is 8 bits. The variables and are plaintext and ciphertext pairs, and they are both an array containing four 32-bit long elements for a total of 128 bits. The SM4 cipher algorithm works for both encryption and decryption; the only difference is that the order of the round keys is reversed. The pseudocode of the SM4 cipher algorithm is shown in Algorithm 2.