Skip to content

Commit

Permalink
Fix FakerPHP#759 : The output of the
Browse files Browse the repository at this point in the history
md5(), sha1() and sha256() generators is misleading
  • Loading branch information
kcassam committed Apr 2, 2024
1 parent 2114cc6 commit 8834477
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Provider/Miscellaneous.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public static function boolean($chanceOfGettingTrue = 50)
*/
public static function md5()
{
return md5(self::numberBetween());
return md5(random_bytes(16));
}

/**
Expand All @@ -259,7 +259,7 @@ public static function md5()
*/
public static function sha1()
{
return sha1(self::numberBetween());
return sha1(random_bytes(20));
}

/**
Expand All @@ -269,7 +269,7 @@ public static function sha1()
*/
public static function sha256()
{
return hash('sha256', self::numberBetween());
return hash('sha256', random_bytes(32));
}

/**
Expand Down

0 comments on commit 8834477

Please sign in to comment.