sm4_encrypt_ecb_to_file | R Documentation |
For ease of use, we have provided functions to encrypt or decrypt data directly from files.
sm4_encrypt_ecb_to_file(input_file, output_file, key)
sm4_decrypt_ecb_from_file(input_file, output_file, key)
sm4_encrypt_cbc_to_file(input_file, output_file, key, iv)
sm4_decrypt_cbc_from_file(input_file, output_file, key, iv)
input_file |
the original file for encrypt, or the encrypted file for decrypt |
output_file |
the encrypted file for encrypt, or the decrypted file for decrypt |
key |
the key, must be a raw vector of length 16 |
iv |
the initialization vector, must be a raw vector of 16 |
returns nothing, and an encrypted file will be saved in the specified path using ecb mode
returns nothing, and a decrypted file will be saved in the specified path using ecb mode
returns nothing, and an encrypted file will be saved in the specified path using cbc mode
returns nothing, and a decrypted file will be saved in the specified path using cbc mode
## Not run:
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)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.