Sha256: 797004f2824020e3c2ecf69b0221534cef01a5e4cabe10eab410be15d84f6f39

Contents?: true

Size: 694 Bytes

Versions: 43

Compression:

Stored size: 694 Bytes

Contents

var assert = require('assert');
var mr = require('../').create();
var bn = require('bn.js');

describe('Miller-Rabin', function() {
  it('should test number for primality', function() {
    assert(!mr.test(new bn(221)));
    assert(mr.test(new bn(257)));

    var p = new bn('dba8191813fe8f51eaae1de70213aafede8f323f95f32cff' +
                   '8b64ebada275cfb18a446a0150e5fdaee246244c5f002ce0' +
                   'aca97584be1745f2dd1eea2849c52aac8c4b5fb78a1c4da7' +
                   '052774338d3310a6e020c46168cb1f94014e9312511cc4fb' +
                   '79d695bb732449f0e015745b86bfa371dc6ca7386e9c7309' +
                   '5549c2e4b8002873', 16);
    assert(mr.test(p));
  });
});

Version data entries

43 entries across 42 versions & 15 rubygems

Version Path
ilog-0.4.0 node_modules/miller-rabin/test/api-test.js
ilog-0.3.3 node_modules/miller-rabin/test/api-test.js
jester-data-8.0.0 node_modules/miller-rabin/test/api-test.js
ezii-os-5.2.1 node_modules/miller-rabin/test/api-test.js
ezii-os-2.0.1 node_modules/miller-rabin/test/api-test.js
ezii-os-1.1.0 node_modules/miller-rabin/test/api-test.js
ezii-os-1.0.0 node_modules/miller-rabin/test/api-test.js
ezii-os-0.0.0.1.0 node_modules/miller-rabin/test/api-test.js
ezii-os-0.0.0.0.1 node_modules/miller-rabin/test/api-test.js
optimacms-0.4.3 spec/dummy/node_modules/miller-rabin/test/api-test.js
optimacms-0.4.2 spec/dummy/node_modules/miller-rabin/test/api-test.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/miller-rabin/test/api-test.js
locomotivecms-3.4.0 app/javascript/node_modules/miller-rabin/test/api-test.js
cortex-0.1.3 spec/dummy/node_modules/miller-rabin/test/api-test.js
dragonfly_puppeteer-0.1.0 node_modules/miller-rabin/test/api-test.js
lanes-0.8.0 node_modules/miller-rabin/test/api-test.js
minimum_viable_product-0.0.11 test/dummy/node_modules/miller-rabin/test/api-test.js
brwy_rails-0.0.6 test/dummy/node_modules/miller-rabin/test/api-test.js
brwy_rails-0.0.5 test/dummy/node_modules/miller-rabin/test/api-test.js
brwy_rails-0.0.4 test/dummy/node_modules/miller-rabin/test/api-test.js