Sha256: 442b8a25e68c71727d56daa0bba74650e17d57293502b264e713acb35951cfd6

Contents?: true

Size: 613 Bytes

Versions: 10

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

require "minitest/autorun"
require "argon2id"

class TestVerify < Minitest::Test
  def test_returns_true_with_correct_password
    encoded = Argon2id.hash_encoded(2, 256, 1, "password", "somesalt", 32)

    assert Argon2id.verify(encoded, "password")
  end

  def test_returns_false_with_incorrect_password
    encoded = Argon2id.hash_encoded(2, 256, 1, "password", "somesalt", 32)

    refute Argon2id.verify(encoded, "notopensesame")
  end

  def test_raises_if_given_invalid_encoded
    assert_raises(Argon2id::Error) do
      Argon2id.verify("", "opensesame")
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
argon2id-0.1.1 test/test_verify.rb
argon2id-0.1.1-x86_64-linux test/test_verify.rb
argon2id-0.1.1-x86_64-darwin test/test_verify.rb
argon2id-0.1.1-x86-mingw32 test/test_verify.rb
argon2id-0.1.1-x86-linux test/test_verify.rb
argon2id-0.1.1-x64-mingw32 test/test_verify.rb
argon2id-0.1.1-x64-mingw-ucrt test/test_verify.rb
argon2id-0.1.1-arm64-darwin test/test_verify.rb
argon2id-0.1.1-arm-linux test/test_verify.rb
argon2id-0.1.1-aarch64-linux test/test_verify.rb