Sha256: fd65fbf6b648624dd4f154e2b31fd74b37a3e3f0fa02f1fa1c867be371a40d83

Contents?: true

Size: 667 Bytes

Versions: 10

Compression:

Stored size: 667 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, 19456, 1, "opensesame", OpenSSL::Random.random_bytes(16), 32)

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

  def test_returns_false_with_incorrect_password
    encoded = Argon2id.hash_encoded(2, 19456, 1, "opensesame", OpenSSL::Random.random_bytes(16), 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.0 test/test_verify.rb
argon2id-0.1.0-x86_64-linux test/test_verify.rb
argon2id-0.1.0-x86_64-darwin test/test_verify.rb
argon2id-0.1.0-x86-mingw32 test/test_verify.rb
argon2id-0.1.0-x86-linux test/test_verify.rb
argon2id-0.1.0-x64-mingw32 test/test_verify.rb
argon2id-0.1.0-x64-mingw-ucrt test/test_verify.rb
argon2id-0.1.0-arm64-darwin test/test_verify.rb
argon2id-0.1.0-arm-linux test/test_verify.rb
argon2id-0.1.0-aarch64-linux test/test_verify.rb