@@ -24,6 +24,21 @@ password hashing algorithms to a modern one.
2424 ACL library! It will only ever deal with creating, verifying and
2525 updating password hashes.*
2626
27+ ### Motivation
28+
29+ PHP's [ password extension] ( https://secure.php.net/password ) is really great,
30+ but it is also still "just" a language primitive - it provides the tools,
31+ not the complete solution. As it should be.
32+
33+ This library is that complete solution.
34+
35+ It is designed to hook into your application, not the other way around,
36+ so you don't need to worry about how to abstract it.
37+ It offers a seamless way to migrate from * any* legacy hashing algorithm,
38+ so you don't have to think about that either.
39+ It is opinionated and intentionally leaves out any custom options, so
40+ there's only one way to use it, no unsafe choices.
41+
2742## Installation
2843
2944PHP 5.6 or newer is required. The latest stable version of PHP is always recommended.
@@ -95,6 +110,11 @@ $dao = new UsersDAO($pdo);
95110$passwordProcessor = new Processor($dao);
96111```
97112
113+ Obviously, your application logic would be a little more complex than that,
114+ and we're only using [ PDO] ( https://secure.php.net/pdo ) as an example here,
115+ but all you really need to use the ` Processor ` class is an object
116+ implementing our ` DAOInterface ` .
117+
98118### Usage
99119
100120``` php
120140
121141### Upgrading from a legacy hash function
122142
143+ Simply pass your old hash function as a callable to the constructor:
144+
123145``` php
124146$passwordProcessor = new Processor($dao, function($inputPassword) use ($salt) {
125147 return \hash('sha256', $inputPassword.$salt);
0 commit comments