Это функция, которую вы можете использовать для конвертации
hexAndBase64(strInput, conversionType) {
if (conversionType == "64ToHex") {
for (var i = 0, bin = atob(strInput.replace(/[ \r\n]+$/, "")), hex = []; i < bin.length; ++i) {
let tmp = bin.charCodeAt(i).toString(16);
if (tmp.length === 1) tmp = "0" + tmp;
hex[hex.length] = tmp;
}
return hex.join(" ");
}
else if (conversionType == "hexTo64") {
return btoa(String.fromCharCode.apply(null,
strInput.replace(/\r|\n/g, "").replace(/([\da-fA-F]{2}) ?/g, "0x$1 ").replace(/ +$/, "").split(" ")));
}
}