Skip to content

web-key-directory


import crypto from "crypto";
import zbase32 from "zbase32";

function hexToZBase32(hexString) {
    const buffer = Buffer.from(hexString, 'hex');
    return zbase32.encode(buffer);
}


function generateSHA1(input) {
    const hash = crypto.createHash('sha1');
    hash.update(input);
    return hash.digest('hex');
}

const inputString = 'bernhard.reiter';
const sha1Hash = generateSHA1(inputString);
console.log("SHA1 hash of '" + inputString + "':", sha1Hash);
console.log(hexToZBase32(sha1Hash))
console.log("it5sewh54rxz33fwmr8u6dy4bbz8itz4")


Sources