Sha256: d33cfe8fba508816a2cbf2e955ff16e2d62f6efa21d04c8582a0f973f0e084bd

Contents?: true

Size: 947 Bytes

Versions: 35

Compression:

Stored size: 947 Bytes

Contents

require File.expand_path(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

35 entries across 35 versions & 1 rubygems

Version Path
braintree-2.30.0 spec/unit/braintree/digest_spec.rb
braintree-2.29.0 spec/unit/braintree/digest_spec.rb
braintree-2.28.0 spec/unit/braintree/digest_spec.rb
braintree-2.27.1 spec/unit/braintree/digest_spec.rb
braintree-2.27.0 spec/unit/braintree/digest_spec.rb
braintree-2.26.0 spec/unit/braintree/digest_spec.rb
braintree-2.25.0 spec/unit/braintree/digest_spec.rb
braintree-2.24.0 spec/unit/braintree/digest_spec.rb
braintree-2.23.0 spec/unit/braintree/digest_spec.rb
braintree-2.22.0 spec/unit/braintree/digest_spec.rb
braintree-2.21.0 spec/unit/braintree/digest_spec.rb
braintree-2.20.0 spec/unit/braintree/digest_spec.rb
braintree-2.19.0 spec/unit/braintree/digest_spec.rb
braintree-2.18.0 spec/unit/braintree/digest_spec.rb
braintree-2.17.0 spec/unit/braintree/digest_spec.rb
braintree-2.16.0 spec/unit/braintree/digest_spec.rb
braintree-2.15.0 spec/unit/braintree/digest_spec.rb
braintree-2.14.0 spec/unit/braintree/digest_spec.rb
braintree-2.13.4 spec/unit/braintree/digest_spec.rb
braintree-2.13.3 spec/unit/braintree/digest_spec.rb