-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_pwd_sha.php
34 lines (26 loc) · 965 Bytes
/
test_pwd_sha.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace OCA\oc_user_pwd;
require_once('pwd_sha.php');
assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_WARNING, 1);
assert_options(ASSERT_QUIET_EVAL, 0);
function test_SSHA() {
echo("Test ".__FUNCTION__."\n");
$password = 'PatataBullida';
$sha = '{SSHA}0aZQBnxh3n9jk2pBvsRQDTEr8QAEz9DL';
assert(PasswordSHA::check($password, $sha), 'Password SSHA correcte');
$password = 'PatataBullida2';
$sha = '{SSHA}0aZQBnxh3n9jk2pBvsRQDTEr8QAEz9DL';
assert(!PasswordSHA::check($password, $sha), 'Password SSHA incorrecte');
}
function test_SHA() {
echo("Test ".__FUNCTION__."\n");
$password = 'PatataBullida';
$sha = '{SHA}vjJHf12oT+sb3UnnXBugAfpd4Cc=';
assert(PasswordSHA::check($password, $sha), 'Password SHA correcte');
$password = 'PatataBullida2';
$sha = '{SHA}vjJHf12oT+sb3UnnXBugAfpd4Cc=';
assert(!PasswordSHA::check($password, $sha), 'Password SHA incorrecte');
}
test_SSHA();
test_SHA();