Skip to content

Commit 123da85

Browse files
committed
md5 to sha256 and removed defuse-encryption, extra tests
1 parent 96b9c35 commit 123da85

File tree

2 files changed

+6
-26
lines changed

2 files changed

+6
-26
lines changed

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ Download the files and require them in your project.
2222
Install the php module if you want to use scrypt hashing
2323

2424

25-
#### [defuse/php-encryption](https://github.com/defuse/php-encryption)
26-
Is required if you want to make use of his encryption library. Will be automatically installed with composer
27-
28-
29-
3025
## Usage
3126
All functions are static public functions right now so you can simply call the functions like this:
3227

tests/test.php

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,6 @@
44
class test extends PHPUnit_Framework_TestCase
55
{
66

7-
public function testEncryptDecrypt()
8-
{
9-
10-
$message = "1234567890abcdefghijklmnopqrstuvwxyz";
11-
$encryptedData = SecureFuncs\SecureFuncs::encrypt($message);
12-
13-
$this->assertArrayHasKey('Key', $encryptedData);
14-
15-
$this->assertNotEmpty($encryptedData['Key']);
16-
17-
$this->assertArrayHasKey('Encrypted', $encryptedData);
18-
19-
$this->assertNotEmpty($encryptedData['Encrypted']);
20-
21-
$decryptedText = SecureFuncs\SecureFuncs::decrypt($encryptedData['Encrypted'], $encryptedData['Key']);
22-
23-
$this->assertEquals($message, $decryptedText);
24-
25-
}
26-
277
public function testRandom()
288
{
299

@@ -40,7 +20,7 @@ public function testRandom()
4020
public function testPassword()
4121
{
4222

43-
$password = "qwerty1234567";
23+
$password = \SecureFuncs\SecureFuncs::randomString(32);
4424

4525
$hash = \SecureFuncs\SecureFuncs::password_hash($password);
4626

@@ -55,4 +35,9 @@ public function testOther()
5535
$this->assertEquals(9, \SecureFuncs\SecureFuncs::strlen('123456789'));
5636
}
5737

38+
public function testCompareStrings()
39+
{
40+
$random_string = \SecureFuncs\SecureFuncs::randomString(12);
41+
$this->assertTrue(\SecureFuncs\SecureFuncs::compareStrings($random_string, $random_string));
42+
}
5843
}

0 commit comments

Comments
 (0)