I have successfully obtained the following result using Unix:
shasum -a 256 test.jpg
df94ac3fd72415827f345b5fa22761f57d87e99c25d5345d2e8e9f6c91ef34a3 test.jpg
However, I am facing issues with getting the same result in Javascript using crypto-browserify
. Here are the results I am getting:
img.onload = function(e) {
console.log(crypto.createHash('sha256').update(e.path[0]).digest('hex'));
console.log(crypto.createHash('sha256').update(e.path).digest('hex'));
console.log(crypto.createHash('sha256').update(e.path[0].src).digest('hex'));
console.log(crypto.createHash('sha256').update(e).digest('hex'));
}
The results returned are:
da5698be17b9b46962335799779fbeca8ce5d491c0e26243bafef9ea1837a9d8
6e340b9cffb37a989ca54ee6bb780a2c78901d3fb33738768511a30617afa01d
7ce85f64d69c7a8865413deaff3d65ca0272dfbe74ad9bc07s5e28679243cb69
da5698be17b9b46962335799779fbeca8ce5d491csd26243bafef9ea1837a9d8
I am unable to achieve the desired
df94ac3fd72415827f345b5fa22761f57d87e99c25d5345d2e8e9f6c91ef34a3
as seen in the Unix command line using shasum
. Can someone provide guidance on how to obtain the correct sha
value?