Changeset 9 for trunk/Modules/User/PasswordHash.php
- Timestamp:
- Jun 1, 2023, 1:01:38 AM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/User/PasswordHash.php
r8 r9 1 1 <?php 2 2 3 3 4 class PasswordHash 4 5 { 5 function Hash( $Password, $Salt)6 function Hash(string $Password, string $Salt): string 6 7 { 7 8 return sha1(sha1($Password).$Salt); 8 9 } 9 10 10 function Verify( $Password, $Salt, $StoredHash)11 function Verify(string $Password, string $Salt, string $StoredHash): bool 11 12 { 12 13 return $this->Hash($Password, $Salt) == $StoredHash; 13 14 } 14 15 15 function GetSalt() 16 function GetSalt(): string 16 17 { 17 mt_srand( microtime(true) * 100000 + memory_get_usage(true));18 mt_srand(intval(microtime(true)) * 100000 + memory_get_usage(true)); 18 19 return sha1(uniqid(mt_rand(), true)); 19 20 }
Note:
See TracChangeset
for help on using the changeset viewer.