UNPKG

groestl-hash-js

Version:

groestl javascript hashing algorithm in pure javascript

39 lines (34 loc) 781 B
'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); } }