Sha256: c8818211c47035b9f5281439d4e25bcc924e6aa53f11df43b1f84c8be4232eee

Contents?: true

Size: 929 Bytes

Versions: 3

Compression:

Stored size: 929 Bytes

Contents

require File.dirname(__FILE__) + "/../spec_helper"

describe Braintree::Digest do
  describe "self.hexdigest" do
    it "returns the sha1 hmac of the input string (test case 6 from RFC 2202)" do
      original_key = Braintree::Configuration.private_key
      private_key = "\xaa" * 80
      data = "Test Using Larger Than Block-Size Key - Hash Key First"
      Braintree::Digest.hexdigest(private_key, data).should == "aa4ae5e15272d00e95705637ce8a3b55ed402112"
    end

    it "returns the sha1 hmac of the input string (test case 7 from RFC 2202)" do
      private_key = "\xaa" * 80
      data = "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data"
      Braintree::Digest.hexdigest(private_key, data).should == "e8e99d0f45237d786d6bbaa7965c7808bbff1a91"
    end

    it "doesn't blow up if message is nil" do
      expect { Braintree::Digest.hexdigest("key", nil) }.to_not raise_error
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
braintree-2.6.0 spec/unit/braintree/digest_spec.rb
braintree-2.5.2 spec/unit/braintree/digest_spec.rb
braintree-2.5.1 spec/unit/braintree/digest_spec.rb