fix: replace shasum with Node.js crypto for cross-platform compatibility
This commit is contained in:
parent
c1ea7738eb
commit
ebf8d30969
@ -32,9 +32,16 @@ collect_files() {
|
|||||||
compute_hash() {
|
compute_hash() {
|
||||||
collect_files \
|
collect_files \
|
||||||
| LC_ALL=C sort -z \
|
| LC_ALL=C sort -z \
|
||||||
| xargs -0 shasum -a 256 \
|
| xargs -0 node -e "
|
||||||
| shasum -a 256 \
|
const crypto = require('crypto');
|
||||||
| awk '{print $1}'
|
const files = process.argv.slice(1);
|
||||||
|
const hashes = files.map(file => {
|
||||||
|
const content = require('fs').readFileSync(file);
|
||||||
|
return crypto.createHash('sha256').update(content).digest('hex');
|
||||||
|
});
|
||||||
|
const combined = hashes.join('');
|
||||||
|
console.log(crypto.createHash('sha256').update(combined).digest('hex'));
|
||||||
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
current_hash="$(compute_hash)"
|
current_hash="$(compute_hash)"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user