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

// Create a hash object
const hash = crypto.createHash('sha256');

// Update with common data
hash.update('Common prefix data');

// Create a copy
const hashCopy = hash.copy();

// Update the original hash with more data
hash.update(' with additional data for original');
const originalDigest = hash.digest('hex');

// Update the copy with different data
hashCopy.update(' with different data for copy');
const copyDigest = hashCopy.digest('hex');

console.log('Original hash:', originalDigest);
console.log('Copy hash:', copyDigest);
console.log('Are they different?', originalDigest !== copyDigest);

// This is useful when you want to create multiple hash variations
// from a common starting point, without recalculating the common portion

              
Original hash: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3
Copy hash: 5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b31a2b3c4d
Are they different? true