if (FALSE) {
key <- '1234567812345678' |> charToRaw()
iv <- '0000000000000000' |> charToRaw()
## ecb mode
sm4_encrypt_ecb_to_file('a.txt', 'a.enc', key)
sm4_decrypt_ecb_from_file('a.enc', 'a.dec', key)
## cbc mode
sm4_encrypt_cbc_to_file('a.txt', 'a.enc', key, iv)
sm4_decrypt_cbc_from_file('a.enc', 'a.dec', key, iv)
}
Run the code above in your browser using DataLab