Skip to main content

#️⃣ Hash

The hash modifier transforms the generated value into a hashed string using one of several supported algorithms.

Supported hashing algorithms:

AlgorithmDescriptionPHP Implementation
BCRYPTStrong password hashing algorithmpassword_hash($value, PASSWORD_BCRYPT)
ARGON2IMemory-hard password hashingpassword_hash($value, PASSWORD_ARGON2I)
ARGON2IDImproved Argon2 variantpassword_hash($value, PASSWORD_ARGON2ID)
MD5MD5 hashingmd5($value)
SHA1SHA-1 hashingsha1($value)
SHA256SHA-256 hashinghash('sha256', $value)

By default, the modifier uses the BCRYPT algorithm.


Example Usage

use IPLeiria\ESTG\EI\DBContextSeeder\TableSeeder;

$seeder->value('password', '123')->hash(); // BCRYPT

Or

use IPLeiria\ESTG\EI\DBContextSeeder\TableSeeder;

$seeder->value('password', '123')->hash(HashAlgorithm::SHA256); // SHA256