You are here

public function CryptTest::providerTestHashBase64 in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/Utility/CryptTest.php \Drupal\Tests\Component\Utility\CryptTest::providerTestHashBase64()

Provides data for self::testHashBase64().

Return value

array Test data.

File

core/tests/Drupal/Tests/Component/Utility/CryptTest.php, line 72

Class

CryptTest
Tests random byte generation.

Namespace

Drupal\Tests\Component\Utility

Code

public function providerTestHashBase64() {
  return [
    [
      'data' => 'The SHA (Secure Hash Algorithm) is one of a number of cryptographic hash functions. A cryptographic hash is like a signature for a text or a data file. SHA-256 algorithm generates an almost-unique, fixed size 256-bit (32-byte) hash. Hash is a one way function – it cannot be decrypted back. This makes it suitable for password validation, challenge hash authentication, anti-tamper, digital signatures.',
      'expectedHash' => '034rT6smZAVRxpq8O98cFFNLIVx_Ph1EwLZQKcmRR_s',
    ],
    [
      'data' => 'SHA-256 is one of the successor hash functions to SHA-1, and is one of the strongest hash functions available.',
      'expected_hash' => 'yuqkDDYqprL71k4xIb6K6D7n76xldO4jseRhEkEE6SI',
    ],
  ];
}