From 0979b67e1baf88d7534d39c9744801a54d487b7f Mon Sep 17 00:00:00 2001 From: nashe Date: Mon, 18 Dec 2017 22:59:42 +0100 Subject: Add hash_equals polyfill and related tests --- app/helpers.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++- tests/HelpersTest.php | 15 +++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 tests/HelpersTest.php diff --git a/app/helpers.php b/app/helpers.php index 3bce65f..8765fc6 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1,5 +1,23 @@ assertTrue(_hash_equals('abc', 'abc')); + $this->assertFalse(_hash_equals('abc', 'ab')); + $this->assertFalse(_hash_equals('ab', 'abc')); + $this->assertFalse(_hash_equals('abcd', 'adbc')); + $this->assertFalse(_hash_equals(0, 0)); + } +} -- cgit v1.2.1