UNPKG

decentralized-internet

Version:

An NPM library of programs to create decentralized web and distributed computing projects

1 lines 420 B
"use strict";const hex={};require("string.prototype.padleft").shim(),hex.add=function(t,e){t.length<e.length?t=t.padLeft(e.length,"0"):e.length<t.length&&(e=e.padLeft(t.length,"0"));let n=0,r="";for(let o=t.length-1;o>=0;o--){const h=parseInt(t[o],16)+parseInt(e[o],16)+n;n=h>>4,r=(15&h).toString(16)+r}return r},hex.pow2x=function(t){const e=t%4,n=Math.floor(t/4);return Math.pow(2,e)+"0".repeat(n)},module.exports=hex;