Skip to content

Instantly share code, notes, and snippets.

View AELSchauer's full-sized avatar

Ashley Schauer AELSchauer

  • GiveCampus
  • Denver, CO
View GitHub Profile
@wteuber
wteuber / encrypt_decrypt.rb
Last active April 3, 2024 13:07
Simply encrypt and decrypt Strings in Ruby.
require 'openssl'
class String
def encrypt(key)
cipher = OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt
cipher.key = Digest::SHA1.hexdigest key
s = cipher.update(self) + cipher.final
s.unpack('H*')[0].upcase
end