From e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Mon, 16 Nov 2020 00:10:28 +0100 Subject: api, login, auth --- node_modules/miller-rabin/bin/miller-rabin | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 node_modules/miller-rabin/bin/miller-rabin (limited to 'node_modules/miller-rabin/bin') diff --git a/node_modules/miller-rabin/bin/miller-rabin b/node_modules/miller-rabin/bin/miller-rabin new file mode 100755 index 0000000..2e18dfd --- /dev/null +++ b/node_modules/miller-rabin/bin/miller-rabin @@ -0,0 +1,29 @@ +#!/usr/bin/env node +var bn = require('bn.js'); +var fs = require('fs'); +var mr = require('../').create(); + +var num = ''; +if (process.argv[2]) { + num += fs.readFileSync(process.argv[2]); + start(num); +} else { + process.stdin.on('data', function(chunk) { + num += chunk.toString().replace(/[^0-9a-f]/gi, ''); + }); + process.stdin.once('end', function() { + start(num); + }); +} + +function start(text) { + var num = new bn(text, 16); + + var divisor = mr.getDivisor(num); + if (!divisor) + process.exit(1); + if (divisor.cmpn(1) === 0) + process.exit(0); + + console.log(divisor.toString(16)); +} -- cgit v1.2.3