bigint-crypto-utils/dist/workerPrimalityTest.js

14 lines
453 B
JavaScript
Raw Normal View History

2019-04-19 07:42:28 +00:00
'use strict';
//const window = self;
importScripts('./bigint-utils-latest.browser.js'); // to be replaced during build with rollup replace
onmessage = async function(event) { // Let's start once we are called
// event.data = {rnd: <bigint>, iterations: <number>}
const isPrime = await bigintUtils.isProbablyPrime(event.data.rnd, event.data.iterations);
postMessage({
'isPrime': isPrime,
'value' : event.data.rnd
});
};