Skip to content

Instantly share code, notes, and snippets.

@cotocisternas
Last active May 25, 2016 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cotocisternas/e7b7b9a23fb22ad687a7de335d410f6d to your computer and use it in GitHub Desktop.
Save cotocisternas/e7b7b9a23fb22ad687a7de335d410f6d to your computer and use it in GitHub Desktop.
Ruby Aut Enc
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