mirror of
https://github.com/danog/fast-srp.git
synced 2024-11-26 20:04:49 +01:00
Update README.md
This commit is contained in:
parent
eda2275cd9
commit
6e6069a088
26
README.md
26
README.md
@ -5,3 +5,29 @@ Is a pure [NodeJS](https://nodejs.org/) implementation of the [SRP6a protocol](h
|
||||
It's a derived work of [Jed Parson](http://jedparsons.com/)'s [node-srp](https://github.com/jedp/node-srp) and [Tom Wu](http://www-cs-students.stanford.edu/~tjw/)'s [jsbn](http://www-cs-students.stanford.edu/~tjw/jsbn/).
|
||||
|
||||
node-srp uses [bignum](https://github.com/justmoon/node-bignum) to handle the big numbers, but I've got many problems with that library mainly compiling it in Windows 7. Finally I've ported the node-srp to use [jsbn](http://www-cs-students.stanford.edu/~tjw/jsbn/).
|
||||
|
||||
|
||||
## Creating the Verifier
|
||||
```javascript
|
||||
'use strict';
|
||||
|
||||
var srp6a = require('fast-srp');
|
||||
|
||||
//
|
||||
// I:
|
||||
var srp6a_create_user = function(I, P, callback) {
|
||||
srp6a.genKey(32, function(error, salt) {
|
||||
if(error) {
|
||||
callback(error);
|
||||
}
|
||||
var v = srp6a.computeVerifier(srp6a.params[4096], salt, new Buffer(I), new Buffer(P));
|
||||
callback(null, v);
|
||||
});
|
||||
}
|
||||
|
||||
srp6a_create_user('Zarmack Tanen', '*****', function(error, verifier) {
|
||||
if(error)
|
||||
throw error;
|
||||
console.log("SRP6a verifier of Zarmack Tanen user is " + verifier.toString('hex'));
|
||||
});
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user