0.0.3 • Published 2 years ago

@authsafe/authsafejs v0.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

�� const stringToHex = (str) => { return str.split("") .map(c => c.charCodeAt(0).toString(16).padStart(2, "0")) .join(""); }

const hexToString = (str) => { return str.split(/(\w\w)/g) .filter(p => !!p) .map(c => String.fromCharCode(parseInt(c, 16))) .join("") }

const hexToDecimal = (hex) => { return parseInt(hex, 16); }

const decimalToHex = (decimal) => { return (decimal).toString(16); }

const convertStringToDecimal = (str) => { const hex = stringToHex(str); return hexToDecimal(hex); }

const convertDecimalToString = (decimal) => { const hex = decimalToHex(decimal); return hexToString(hex); }