Created
February 13, 2013 13:04
-
-
Save jonahoffline/4944459 to your computer and use it in GitHub Desktop.
Crypt example.
This file contains 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 CustomAuth | |
def initialize(secret) | |
@secret = secret | |
end | |
def encrypt(key) | |
@secret.crypt(key) | |
end | |
def decrypt(key) | |
if encrypt(key) == key | |
'authenticated' | |
else | |
'error: wrong key' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment