* feat: pnpm new * Refactor build and release workflows, update dependencies Switch build scripts and workflows from npm to pnpm, update build and artifact paths, and simplify release workflow by removing version detection and changelog steps. Add new dependencies (silk-wasm, express, ws, node-pty-prebuilt-multiarch), update exports in package.json files, and add vite config for napcat-framework. Also, rename manifest.json for framework package and fix static asset copying in shell build config.
20 lines
673 B
TypeScript
20 lines
673 B
TypeScript
import crypto from 'crypto';
|
|
import assert from 'assert';
|
|
import { Sha1Stream } from './sha1Stream';
|
|
|
|
function testSha1Stream () {
|
|
for (let i = 0; i < 100000; i++) {
|
|
const randomLength = Math.floor(Math.random() * 1024);
|
|
const randomData = crypto.randomBytes(randomLength);
|
|
const sha1Stream = new Sha1Stream();
|
|
sha1Stream.update(randomData);
|
|
const hash = sha1Stream.final();
|
|
const expectedDigest = crypto.createHash('sha1').update(randomData).digest();
|
|
assert.strictEqual(hash.toString('hex'), expectedDigest.toString('hex'));
|
|
console.log(`Test ${i + 1}: Passed`);
|
|
}
|
|
console.log('All tests passed successfully.');
|
|
}
|
|
|
|
testSha1Stream();
|