0
$ echo -e 'blob 14\0Hello, World!' | shasum
は生成:JS /ノードでこれを実行している8ab686eafeb1f44702738c8b0f24f2567c36da6d
のgit shasumとノードSHA1が同じhasheを生じない
を:
var sha1 = require('sha1');
const fileContents = "Hello, World!";
const length = fileContents.length + 1;
const blobString = `blob ${length}\0${fileContents}`;
const hash = sha1(blobString);
console.log(blobString);
console.log(hash);
は生成します。
blob 14Hello, World!
d4fcfe4d339d4e59d168fdf3c0ad445fa980a7d6
はなぜですハッシュは等しくない? (8ab686eafeb1f44702738c8b0f24f2567c36da6d != d4fcfe4d339d4e59d168fdf3c0ad445fa980a7d6
)