summaryrefslogtreecommitdiffstats
path: root/tests/Stubs/Crypto.php
blob: 0e8d13a0f552f34c9d123b5ffec99afdf9f7c10d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

/**
 * Minimal Crypto stub for testing code paths that depend on password hashing.
 */
class Crypto
{
	public static function hash6(string $password): string
	{
		// Deterministic placeholder hash for testing
		return 'HASHED-' . $password;
	}

	public static function verify(string $password, string $hash): bool
	{
		// Accept if hash matches a canned value or if it equals our hash6()
		if ($hash === 'STORED' && $password === 'ok') {
			return true;
		}
		return $hash === self::hash6($password);
	}
}