Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Argon2 as supported algo #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ npm update

Create the configuration for your coin:

Possible options for `algorithm`: *sha256, scrypt, scrypt-jane, scrypt-n, quark, x11, keccak, blake,
skein, groestl, fugue, shavite3, hefty1, qubit, or sha1*.
Possible options for `algorithm`: *argon2d, argon2i, argon2id, sha256, scrypt, scrypt-jane, scrypt-n, quark, x11,
keccak, blake, skein, groestl, fugue, shavite3, hefty1, qubit, or sha1*.

```javascript
var myCoin = {
Expand Down Expand Up @@ -157,6 +157,18 @@ var myCoin = {
};
```

If you are using the `argon2d`, `argon2i`, or `argon2id` algorithm there are additional configurations:
```javascript
var myCoin = {
"name": "Unitus",
"symbol": "UIS",
"algorithm": "argon2d",
"tValue": 1, //optional - defaults to 1
"mValue": 4096, //optional - defaults to 4096
"pValue": 1 //optional - defaults to 1
};
```


Create and start new pool with configuration options and authentication function

Expand Down
38 changes: 38 additions & 0 deletions lib/algoProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,44 @@ var util = require('./util.js');
var diff1 = global.diff1 = 0x00000000ffff0000000000000000000000000000000000000000000000000000;

var algos = module.exports = global.algos = {
'argon2d': {
//Uncomment diff if you want to use hardcoded truncated diff
//diff: '0000ffff00000000000000000000000000000000000000000000000000000000',
multiplier: Math.pow(2, 16),
hash: function(coinConfig){
var tValue = coinConfig.tValue || 1;
var mValue = coinConfig.mValue || 4096;
var pValue = coinConfig.pValue || 1;
return function(data){
return multiHashing.argon2d(data,tValue,mValue,pValue);
}
}
},
'argon2i': {
//Uncomment diff if you want to use hardcoded truncated diff
//diff: '0000ffff00000000000000000000000000000000000000000000000000000000',
multiplier: Math.pow(2, 16),
hash: function(coinConfig){
var tValue = coinConfig.tValue || 1;
var mValue = coinConfig.mValue || 4096;
var pValue = coinConfig.pValue || 1;
return function(data){
return multiHashing.argon2i(data,tValue,mValue,pValue);
}
}
},
'argon2id': {
//Uncomment diff if you want to use hardcoded truncated diff
//diff: '0000ffff00000000000000000000000000000000000000000000000000000000',
hash: function(coinConfig){
var tValue = coinConfig.tValue || 1;
var mValue = coinConfig.mValue || 4096;
var pValue = coinConfig.pValue || 1;
return function(data){
return multiHashing.argon2id(data,tValue,mValue,pValue);
}
}
},
sha256: {
//Uncomment diff if you want to use hardcoded truncated diff
//diff: '00000000ffff0000000000000000000000000000000000000000000000000000',
Expand Down