Created
February 25, 2020 19:25
-
-
Save dimitrisdovinos/b2789f24c16853563ffc39ceffe57f23 to your computer and use it in GitHub Desktop.
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
require 'openssl' | |
require 'base64' | |
aes = OpenSSL::Cipher.new("AES-256-CBC") | |
aes.encrypt | |
aes.key = Base64.decode64("4VZS/oCY73fTENgF8LyLq00B+bsXEHLlAFpRhoDXTKc=") | |
aes.iv = OpenSSL::Cipher.new("AES-256-CBC").random_iv | |
cipher = aes.update("I'm scared if I stop all at once, the cumulative hangover will literally kill me.") | |
cipher << aes.final | |
Base64.encode64(cipher) | |
# "Xfu+6jKYygwB6GlIj6zqL+Q0r3zBMo/zoAtTapREjFOCqb3+oaySCxx4Y8fV\nDg7OfUL0YBSAXzPkbV7qpqViVBcjfX9phao16CCxOObFGTXrXGgEmdxwvO85\ngESN/r/d\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment