SHA256 Of Stdin Stream
NodeJS
Hard
4 views
Problem Description
Read stdin as stream and print sha256 hex.
Input Format
stdin: any text.
Output Format
Print sha256.
Constraints
Use crypto hash and update on data.
Official Solution
const crypto = require('crypto');
const h = crypto.createHash('sha256');
process.stdin.on('data', (chunk) => h.update(chunk));
process.stdin.on('end', () => console.log(h.digest('hex')));
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!