ROS-Ethereum: A Convenient Tool to Bridge ROS and Blockchain (Ethereum)
Algorithm 4
The pseudocode of the SM2 encrypt algorithm.
(i)
Input: the bit string type message , the public key , and the random number
(ii)
Output: the bit string type ciphertext
(iii)
Begin
(iv)
(v)
(vi)
If equals
(vii)
throw error and exit
(viii)
(ix)
(x)
End
(xi)
SM2 Decrypt: The variable is the ciphertext to be decrypted, and the variable is the decrypted message, both of which are bit string types. The variable ,, and are bit strings extracted from variable according to certain rules. The variable is the private key of the integer type. The pseudocode of SM2 decrypt is shown in Algorithm 5.