On Fri, Mar 19, 2010 at 5:10 PM, Barry Rowlingson <b.rowling...@lancaster.ac.uk> wrote: > On Fri, Mar 19, 2010 at 5:00 PM, Hadley Wickham <had...@rice.edu> wrote: >> Hi all, >> >> Does any one know of any encryption/decryption algorithms in R? I'm >> not looking for anything robust - I want some way of printing output >> to the screen that the user can't read immediately, but can decrypt a >> little later. The main thing I don't want to the user to see is a >> number, so (e.g.) ROT13 isn't appropriate. > > You could just include the numbers in a ROT13-sort of algorithm. It > would end up being ROT-18 I guess...
"ROT-18" (?) using chartr: > oldletters=c(letters,0:9) > old=paste(oldletters,collapse="") > new=paste(c(oldletters[19:36],oldletters[1:18]),collapse="") > chartr(old,new,message) [1] "g6c zsdw e65 kl.qr v633s9a" > chartr(old,new,chartr(old,new,message)) [1] "you have won 23.89 dollars" Barry ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.