Sha256: 5ea1f2cf70771f16d531dbcb50b544a10a0200930a788072be757daec9e19398
Contents?: true
Size: 426 Bytes
Versions: 3
Compression:
Stored size: 426 Bytes
Contents
require 'digest/md5' module Alipay module Sign def self.generate(params) query = params.sort.map do |key, value| "#{key}=#{value}" end.join('&') Digest::MD5.hexdigest("#{query}#{Alipay.key}") end def self.verify?(params) params = Utils.stringify_keys(params) params.delete('sign_type') sign = params.delete('sign') generate(params) == sign end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
alipay-0.0.4 | lib/alipay/sign.rb |
alipay-0.0.3 | lib/alipay/sign.rb |
alipay-0.0.2 | lib/alipay/sign.rb |