Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sapamatech committed Feb 12, 2014
1 parent 302b41e commit 30b419d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ echo "Hash is ". ($isValid ? 'valid': 'not valid');
<h4>Hash generation</h4>
The hash is generated by:

1. The ```php digest($dataToHash, $algo = 'sha256', $raw_output = false, $separator = '.')``` function takes a string or array as parameter of data to be hashed eg;
1. The ```digest($dataToHash, $algo = 'sha256', $raw_output = false, $separator = '.')``` function takes a string or array as parameter of data to be hashed eg;

```php
<?php
Expand Down Expand Up @@ -92,4 +92,10 @@ $hash = '87304e9ab39f1d9c70b9f51f9f3b70fed5d19fbd3917ea3678115c5adffcf0d5';
2. This function return <code>true</code> if hash is verified, <code>false</code> otherwise


1. you pass the hash and the data from w
<h1>Possible applications</h1>
1. Securing API - This library can be used to generate hash digest plus an ``` API_SECRET ``` (see below) of data to be passed to an API. Remember to also include the generated hash to the data being POSTed so that the API can generate an hash using the data and try and verify against the POSTed hash.

NB: ```API_SECRET``` This is code or a random string known only to the API provider and consumer and is included in the data to be hashed to make the hash more difficult to regenerate.

Happy Coding!

0 comments on commit 30b419d

Please sign in to comment.