class String
Public Instance Methods
decrypt(key)
click to toggle source
# File lib/ext/string.rb, line 12 def decrypt(key) cipher = OpenSSL::Cipher.new('DES-EDE3-CBC').decrypt cipher.key = Digest::SHA1.hexdigest(key)[0..23] s = [self].pack("H*").unpack("C*").pack("c*") cipher.update(s) + cipher.final end
encrypt(key)
click to toggle source
# File lib/ext/string.rb, line 4 def encrypt(key) cipher = OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt cipher.key = Digest::SHA1.hexdigest(key)[0..23] s = cipher.update(self) + cipher.final s.unpack('H*')[0].upcase end