Last active
May 25, 2016 02:51
-
-
Save cotocisternas/e7b7b9a23fb22ad687a7de335d410f6d to your computer and use it in GitHub Desktop.
Ruby Aut Enc
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' | |
key = 'hello'.ljust(8, "\x00") | |
txt = 'hello'.ljust(64, "\x00") | |
des = OpenSSL::Cipher.new('DES-ECB') | |
des.encrypt | |
des.key = key | |
plain = des.update(txt) + des.final | |
Base64.encode64(plain) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment