Sha256: b7b4aaeb47b87c2cc6410cb29f2d7d4015f5699b200fdd57444d9bbf7d01b0fd
Contents?: true
Size: 794 Bytes
Versions: 2
Compression:
Stored size: 794 Bytes
Contents
module Brickwall module Signature class << self def calculate_v2(params = {}) data = string_params(sorted_params!(params.to_a)) + Brickwall.configuration.widget_secret_key Digest.hexencode OpenSSL::Digest::MD5.digest data end def calculate_v3(params = {}) data = string_params(sorted_params!(params.to_a)) + Brickwall.configuration.widget_secret_key Digest.hexencode OpenSSL::Digest::SHA256.digest data end private def sorted_params!(arr_params) arr_params.sort! { |(k1,_), (k2,_)| k1 <=> k2 } end def string_params(arr_params) str = StringIO.new arr_params.each do |(k, v)| str << k.to_s str << '=' str << v.to_s end str.string end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
brickwall-0.2.0 | lib/brickwall/signature.rb |
brickwall-0.1.0 | lib/brickwall/signature.rb |