2016-04-18 22:10:20 +08:00
|
|
|
'use strict';
|
|
|
|
|
2016-09-29 02:14:23 +08:00
|
|
|
const common = require('../../common');
|
2017-07-01 07:29:09 +08:00
|
|
|
if (!common.hasCrypto)
|
2017-03-01 15:16:48 +08:00
|
|
|
common.skip('missing crypto');
|
2017-07-01 07:29:09 +08:00
|
|
|
|
2016-04-18 22:10:20 +08:00
|
|
|
const assert = require('assert');
|
2016-09-29 02:14:23 +08:00
|
|
|
const binding = require(`./build/${common.buildType}/binding`);
|
2016-04-18 22:10:20 +08:00
|
|
|
const bytes = new Uint8Array(1024);
|
|
|
|
assert(binding.randomBytes(bytes));
|
|
|
|
assert(bytes.reduce((v, a) => v + a) > 0);
|
2023-01-31 15:19:01 +08:00
|
|
|
assert(binding.hash(bytes));
|