sha_256 1.0.0

Optimised sha-256
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function hexToByteArray(hex) {
    if (hex.length % 2 !== 0) {
        throw new Error("Hex string must have an even length.");
    }
    const byteArray = [];
    for (let i = 0; i < hex.length; i += 2) {
        byteArray.push(parseInt(hex.substr(i, 2), 16));
    }
    return byteArray;
}

const hexString = process.argv[2];
try {
    const byteArray = hexToByteArray(hexString);
    console.log(byteArray);
} catch (error) {
    console.error(error.message);
}