source: trunk/Modules/User/PasswordHash.php

Last change on this file was 9, checked in by chronos, 19 months ago
  • Fixed: Modules initialization.
File size: 430 bytes
Line 
1<?php
2
3
4class PasswordHash
5{
6 function Hash(string $Password, string $Salt): string
7 {
8 return sha1(sha1($Password).$Salt);
9 }
10
11 function Verify(string $Password, string $Salt, string $StoredHash): bool
12 {
13 return $this->Hash($Password, $Salt) == $StoredHash;
14 }
15
16 function GetSalt(): string
17 {
18 mt_srand(intval(microtime(true)) * 100000 + memory_get_usage(true));
19 return sha1(uniqid(mt_rand(), true));
20 }
21}
Note: See TracBrowser for help on using the repository browser.