Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function hmac(data) {
return nacl.hash(Uint8Tool.concat(okeypad, nacl.hash(Uint8Tool.concat(ikeypad, data))));
}
// BIG endian encoding of integer i.
function make (ad) {
console.log(ad)
var hex = Buffer.from(nacl.hash(nacl.util.decodeUTF8(ad))).toString('hex')
var obj = {
hash: hex,
ad: ad,
views: 0
}
fs.writeFile(addir + hex, JSON.stringify(obj), 'UTF-8', function () {
console.log('Saved as ' + hex)
})
}
function sendRaw(bugout, message) {
var wires = bugout.torrent.wires;
for (var w=0; w
function computeObjectHash(obj: {}) {
if (!obj)
return '';
const str = canonicalize(obj);
const bytes = decodeUTF8(str);
const result = hash(bytes);
const b64 = encodeBase64(result);
return b64;
}
function hmac(data) {
return nacl.hash(
Uint8Tool.concat(okeypad, nacl.hash(Uint8Tool.concat(ikeypad, data)))
);
}
Bugout.encodeaddress = Bugout.prototype.encodeaddress = function(material) {
return bs58check.encode(Buffer.concat([Buffer.from(ADDRESSPREFIX, "hex"), new ripemd160().update(Buffer.from(nacl.hash(material))).digest()]));
}
function shorten(value: string) {
if (value.startsWith('"-----BEGIN RSA PUBLIC KEY-----')) {
const bytes = decodeUTF8(value);
const result = hash(bytes);
const b64 = encodeBase64(result);
return b64.substr(0, 16);
}
else if (value.length > 100) {
return value.substr(0, 50) + '...' + value.substr(value.length - 47);
}
else {
return value;
}
}