Sha256: 297c0c15ee881d0f52fa56e4d426793689f9ee8846d9ffc63dc64605903b0b1a
Contents?: true
Size: 465 Bytes
Versions: 1
Compression:
Stored size: 465 Bytes
Contents
require 'openssl' class String 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 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bits_dealer-0.1.1 | lib/ext/string.rb |