mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 21:52:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
29
web/node_modules/miller-rabin/bin/miller-rabin
generated
vendored
Executable file
29
web/node_modules/miller-rabin/bin/miller-rabin
generated
vendored
Executable file
|
@ -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));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue