I am trying to create a SHA-256 hash for files.
I used https://www.npmjs.com/package/crypto-js for this. see below code for this.
import { Component, OnInit } from '@angular/core';
var SHA256 = require("crypto-js/sha256");
@Component({
moduleId: module.id,
selector: 'dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.css']
})
export class DashboardComponent implements OnInit {
hash: string;
constructor() { }
ngOnInit() {}
onFilesChange(fileList : Array<File>){
this.fileList = fileList;
console.log(fileList);
for(var file in fileList){
this.hash = SHA256(file);
console.log(this.hash.toString());
}
}
}
File: file for sha-256
with the above code, I got the below hash of the sh256 file: 5feceb66ffc86f38d952786c6d696c79c2dbc239dd4e91b46729d73a27fb57e9
but I link to many online sites like http://onlinemd5.com/,http://www.online-convert.com/,https://md5file.com/calculator
form an online website that i got below sha256 hash: 27bb4358e847d559bed9f34eeee51ca71f51542afb0de4017b80dd66a0656eca
can someone tell me why i get different hashes?