Last active
April 14, 2017 11:16
-
-
Save thomasjslone/ca4fcffa7d482884f2a18ca23a75bf81 to your computer and use it in GitHub Desktop.
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
class Simpleton_Cipher | |
def initialize ; @chset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,./;'[]-=<>?:\"{}_+)(|\\*&^%$#@!~` \n" ; end | |
def generate_key ; key = @chset ; key = key.split('').shuffle.join('').to_s ; key ; end | |
def encode(str,key) ; str.tr(@chset, key) ; end | |
def decode(str,key) ; str.tr(key, @chset) ; end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment