Created
January 19, 2016 15:45
-
-
Save trestletech/69b559016d74ff2fe430 to your computer and use it in GitHub Desktop.
encrypting arbitrary amounts of data in R using PKI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(PKI) | |
txt <- ("This is an encryption test that has a variety of characters and is fairly long so that we can test whether or not it's actually using the stream cipher") | |
corpus <- paste(rep(txt, 5000), collapse="") | |
x <- charToRaw(corpus) | |
length(x) | |
key <- PKI.digest(charToRaw("this is a small key but it's getting bigger by the second"), "SHA256") | |
ae <- PKI.encrypt(x, key, "aes256") | |
ad <- PKI.decrypt(ae, key, "aes256") | |
stopifnot(identical(x, ad)) | |
stopifnot(!identical(ad, ae)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment