Skip to content

Commit 10d02b9

Browse files
committed
1 parent 29fdbc1 commit 10d02b9

File tree

5 files changed

+545
-2
lines changed

5 files changed

+545
-2
lines changed

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,29 @@
1-
# pacrypt
2-
standalone PHP library for creating various password hashes
1+
# PostfixAdmin\PasswordHashing
2+
3+
Standalone PHP library for creating various password hashes
4+
5+
Note, this library is still quite new (2021/07/02). It's quite likely to have major refactoring / renaming as it's reviewed.
6+
7+
8+
## Example usage
9+
10+
```PHP
11+
$tool = new \PostfixAdmin\PasswordHashing\Crypt();
12+
13+
// should output something to indicate what your system supports (may be dependent on PHP variant, PHP modules etc)
14+
var_dump($tool->supportedMechanisms()); // e.g. MD5, SHA1, ARGON2I.
15+
16+
var_dump($tool->hash(Crypt::CLEARTEXT, 'fishbeans'));
17+
18+
var_dump($tool->hash(Crypt::MD5, 'fishbeans'));
19+
20+
var_dump($tool->verify(Crypt::MD5, 'fishbeans', 'some-hash'));
21+
22+
var_dump($tool->verify(Crypt::ARGON2I, 'fishbeans', 'some-hash'));
23+
24+
```
25+
26+
27+
## ChangeLog
28+
29+
2021/07/03 - Initial release / copying of code from https://github.com/postfixadmin/postfixadmin ...

composer.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "postfixadmin/password-hashing",
3+
"description": "Routines to generate password hashes, useful for Dovecot or Courier Mail servers",
4+
"type": "library",
5+
"require": {
6+
"php": ">=7.2"
7+
},
8+
"require-dev": {
9+
"vimeo/psalm": "^4.8",
10+
"phpunit/phpunit": "^8|^9",
11+
"friendsofphp/php-cs-fixer" : "*"
12+
},
13+
"license": "GPLv2",
14+
"scripts": {
15+
"psalm" : "@php vendor/bin/psalm src",
16+
"test" : "@php vendor/bin/phpunit tests",
17+
"format" : [
18+
"@php vendor/bin/php-cs-fixer fix src ",
19+
"@php vendor/bin/php-cs-fixer fix tests"
20+
]
21+
},
22+
"autoload" : {
23+
"psr-4" : {
24+
"PostfixAdmin\\PasswordHashing\\" : "src"
25+
}
26+
},
27+
"authors": [
28+
{
29+
"name": "David Goodwin",
30+
"email": "david@codepoets.co.uk"
31+
}
32+
]
33+
}

0 commit comments

Comments
 (0)