Module: Wechat::Signature

Defined in:
lib/wechat/signature.rb

Class Method Summary collapse

Class Method Details

.hexdigest(token, timestamp, nonce, msg_encrypt) ⇒ Object



5
6
7
8
9
10
# File 'lib/wechat/signature.rb', line 5

def self.hexdigest(token, timestamp, nonce, msg_encrypt)
  array = [token, timestamp, nonce]
  array << msg_encrypt unless msg_encrypt.nil?
  dev_msg_signature = array.compact.collect(&:to_s).sort.join
  Digest::SHA1.hexdigest(dev_msg_signature)
end