forked from Groestlcoin/groestl-hash-js
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
39 lines (34 loc) · 781 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';
var groestl = require('./lib/groestl');
var h = require('./lib/helper');
var x11hash = module.exports;
module.exports.groestl512 = function(str,format, output) {
return groestl(str,format,output);
}
module.exports.groestl = function(str,format, output) {
var a = groestl(str,format,2);
a = a.slice(0,8);
if (output === 2) {
return a;
}
else if (output === 1) {
return h.int32Buffer2Bytes(a);
}
else {
return h.int32ArrayToHexString(a);
}
}
module.exports.groestl_2 = function(str,format, output) {
var a = groestl(str,format,2);
a = groestl(a,2,2);
a = a.slice(0,8);
if (output === 2) {
return a;
}
else if (output === 1) {
return h.int32Buffer2Bytes(a);
}
else {
return h.int32ArrayToHexString(a);
}
}