Sha256: f95cc6797bc085467ce4512bcd88a5ed0f220bfb43e37cd7b2b972fe7274bee8

Contents?: true

Size: 1.76 KB

Versions: 1

Compression:

Stored size: 1.76 KB

Contents

require 'spec_helper'
require 'ronin/formatting/digest'

describe String do
  subject { "hello" }

  it "should provide String#md5" do
    should respond_to(:md5)
  end

  it "should provide String#sha1" do
    should respond_to(:sha1)
  end

  it "should provide String#sha2" do
    should respond_to(:sha2)
  end

  it "should provide String#sha256" do
    should respond_to(:sha256)
  end

  it "should provide String#sha512" do
    should respond_to(:sha512)
  end

  describe "#md5" do
    subject { "test" }

    let(:digest_md5) { "098f6bcd4621d373cade4e832627b4f6" }

    it "should return the MD5 digest of itself" do
      expect(subject.md5).to eq(digest_md5)
    end
  end

  describe "#sha1" do
    subject { "test" }

    let(:digest_sha1) { "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3" }

    it "should return the SHA1 digest of itself" do
      expect(subject.sha1).to eq(digest_sha1)
    end
  end

  describe "#sha2" do
    subject { "test" }

    let(:digest_sha2) do
      "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
    end

    it "should return the SHA2 digest of itself" do
      expect(subject.sha2).to eq(digest_sha2)
    end
  end

  describe "#sha256" do
    subject { "test" }

    let(:digest_sha256) do
      "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
    end

    it "should return the SHA256 digest of itself" do
      expect(subject.sha256).to eq(digest_sha256)
    end
  end

  describe "#sha512" do
    subject { "test" }

    let(:digest_sha512) do
      "ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff"
    end

    it "should return the SHA512 digest of itself" do
      expect(subject.sha512).to eq(digest_sha512)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ronin-support-0.5.2 spec/formatting/digest/string_spec.rb