module Netpayclient::Crypto

Public Class Methods

crypto() click to toggle source
# File lib/netpayclient.rb, line 11
def self.crypto
  if defined?(@@crypto).nil?
    @@crypto = Mcrypt.new(:des, :cbc)
    @@crypto.key = DES_KEY
    @@crypto.iv = "\x00" * 8
    @@crypto.padding = false
  end
  @@crypto
end
decrypt(str) click to toggle source
# File lib/netpayclient.rb, line 21
def self.decrypt(str)
  if str.empty?
    "\xEE\xB3\x16\x86\xAB\x84G\x90"
  else
    self.crypto.decrypt(str)
  end
end