Sha256: f08be31e4021fc2029e7b5a6d63e3195fb9351a098a0b7549bd550df004676de

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

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
      begin
        original_key = Braintree::Configuration.private_key
        Braintree::Configuration.private_key = "\xaa" * 80
        data = "Test Using Larger Than Block-Size Key - Hash Key First"
        Braintree::Digest.hexdigest(data).should == "aa4ae5e15272d00e95705637ce8a3b55ed402112"
      ensure
        Braintree::Configuration.private_key = original_key
      end
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
braintree-1.0.1 spec/unit/braintree/digest_spec.rb
braintree-1.0.0 spec/unit/braintree/digest_spec.rb