Created
February 16, 2019 21:46
-
-
Save hisasann/42cc85ac73361849244cb6046e3bc0bd to your computer and use it in GitHub Desktop.
ファイルから sha1 のハッシュ値を計算するコード
This file contains hidden or 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
'use strict' | |
const crypto = require('crypto'); | |
const fs = require('fs'); | |
const shasum = crypto.createHash('sha1'); | |
const app_a = __dirname + '/path/to/file.txt'; | |
fs.readFile(app_a, (err, data) => { | |
shasum.update(data); | |
console.log(app_a, shasum.digest('hex')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment