Sha256: 3389d36054de3ea2d4d938620568283d865b47974d358500a2b973f1caf47d8d
Contents?: true
Size: 695 Bytes
Versions: 4
Compression:
Stored size: 695 Bytes
Contents
require 'digest/md5' module JohnHancock def sign(shared_secret = "", signature_keys = ["signature"]) hash_signature = self.clone # Remove the "calculated_signature" entry signature_keys.each do |signature_key| hash_signature.delete(signature_key.to_s) hash_signature.delete(signature_key.to_sym) end calculated_signature = hash_signature.collect { |k, v| "#{k}=#{v}" } calculated_signature = calculated_signature.sort calculated_signature = calculated_signature.join # Final calculated_signature to compare against calculated_signature = Digest::MD5.hexdigest(shared_secret + calculated_signature) end end Hash.send(:include,JohnHancock)
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
john-hancock-0.1.3 | lib/john-hancock.rb |
john-hancock-0.1.2 | lib/john-hancock.rb |
john-hancock-0.1.1 | lib/john-hancock.rb |
john-hancock-0.1.0 | lib/john-hancock.rb |