Last active
April 27, 2024 06:11
-
-
Save azizur/b8eb54b505552d913d286345774c70ec to your computer and use it in GitHub Desktop.
Proposal for generating Unique Device Identification (UDI)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const hash = crypto.createHash('sha256'); | |
const hashValue = (data) => { | |
return hash.update(JSON.stringify(data), 'utf-8').digest('hex'); | |
}; | |
// generate a hash | |
console.log(hashValue(['userId', 'deviceId'])); | |
// output | |
// 104a4a7d0908e67ebf91a46ba34b48d846a181d2f41b4df792f943f30bd199f1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment