JSFiddle - React, Tailwind, and code Playground
HTML
<head></head>
<body>
<input type="file" id="fileinput" onchange="myFunction()">
</body>
JavaScript
function myFunction(){
var finput = document.getElementById('fileinput');
var file = finput.files[0];
console.log(file.size);
const hashBuffer = crypto.subtle.digest('SHA-256', file); // hash the message
const hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
console.log(hashHex);
}