mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
performance and optimization
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import * as crypto from 'crypto';
|
||||
|
||||
import { hash256 } from './hash.utils';
|
||||
|
||||
describe('hash256', () => {
|
||||
it('matches native double sha256 for known input', () => {
|
||||
const data = Buffer.from('public-pool-share-validation', 'utf8');
|
||||
const expected = crypto
|
||||
.createHash('sha256')
|
||||
.update(crypto.createHash('sha256').update(data).digest())
|
||||
.digest('hex');
|
||||
|
||||
expect(hash256(data).toString('hex')).toBe(expected);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user