Sha256: bbb299d7f12959f37502dfba9129058aad8e1872323f36424216d5491d586ac7
Contents?: true
Size: 615 Bytes
Versions: 3
Compression:
Stored size: 615 Bytes
Contents
# coding: utf-8 module JytPay module Encrypt module Des ALG = 'DES-CBC' def self.encrypt(str, key_arg = Encrypt::DES_KEY) des = OpenSSL::Cipher::Cipher.new(ALG) des.key = key_arg des.iv = key_arg des.encrypt cipher = des.update(str) + des.final cipher.unpack('H*')[0] end def self.decrypt(xml_enc, key_str) xml_str = [xml_enc].pack 'H*' des = OpenSSL::Cipher::Cipher.new(ALG) des.decrypt des.key = key_str des.iv = key_str des.update(xml_str) + des.final end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jyt_pay-0.3.0 | lib/jyt_pay/encrypt/des.rb |
jyt_pay-0.2.0 | lib/jyt_pay/encrypt/des.rb |
jyt_pay-0.1.0 | lib/jyt_pay/encrypt/des.rb |