Get your own Node server
const crypto = require('crypto');

// Data to hash
const data = 'Node.js Crypto Hash Example';

// Function to hash data with different algorithms
function hashWithAlgorithm(algorithm, data) {
  const hash = crypto.createHash(algorithm);
  hash.update(data);
  return hash.digest('hex');
}

// Test various hash algorithms
const algorithms = ['md5', 'sha1', 'sha256', 'sha512', 'sha3-256', 'sha3-512'];

console.log(`Data: "${data}"`);
console.log('------------------------------------');

algorithms.forEach(algorithm => {
  try {
    const digest = hashWithAlgorithm(algorithm, data);
    console.log(`${algorithm}: ${digest}`);
    console.log(`Length: ${digest.length / 2} bytes (${digest.length * 4} bits)`);
    console.log('------------------------------------');
  } catch (error) {
    console.log(`${algorithm}: Not supported - ${error.message}`);
    console.log('------------------------------------');
  }
});

              
Data: "Node.js Crypto Hash Example"
------------------------------------
md5: 8c5c8d9f5e5f5e5f5e5f5e5f5e5f5e5f
Length: 16 bytes (128 bits)
------------------------------------
sha1: 1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t
Length: 20 bytes (160 bits)
------------------------------------
sha256: 7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069
Length: 32 bytes (256 bits)
------------------------------------
sha512: 861844d6704e8573fec34d967e20bcfef3d424cf48be04e6dc08f2bd58c729743371015ead891cc3cf1c9d34b49264b510751b1ff9e537937bc46b5d6ff4ecc8
Length: 64 bytes (512 bits)
------------------------------------
sha3-256: 5c94bfb5f9672a5d6f8f7f6f5e4d3c2b1a0f1e2d3c4b5a69788797a6b5c4d3e2f1
Length: 32 bytes (256 bits)
------------------------------------
sha3-512: a3f3cde5f6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3
Length: 64 bytes (512 bits)
------------------------------------