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
optimacms-0.1.61 spec/dummy/node_modules/miller-rabin/test/api-test.js
disco_app-0.18.0 test/dummy/node_modules/miller-rabin/test/api-test.js
disco_app-0.18.2 test/dummy/node_modules/miller-rabin/test/api-test.js
disco_app-0.16.1 test/dummy/node_modules/miller-rabin/test/api-test.js
disco_app-0.15.2 test/dummy/node_modules/miller-rabin/test/api-test.js
disco_app-0.18.4 test/dummy/node_modules/miller-rabin/test/api-test.js
disco_app-0.18.1 test/dummy/node_modules/miller-rabin/test/api-test.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/miller-rabin/test/api-test.js
disco_app-0.14.0 test/dummy/node_modules/miller-rabin/test/api-test.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/miller-rabin/test/api-test.js
tang-0.2.1 spec/tang_app/node_modules/miller-rabin/test/api-test.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/miller-rabin/test/api-test.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/miller-rabin/test/api-test.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/miller-rabin/test/api-test.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/miller-rabin/test/api-test.js
tang-0.2.0 spec/tang_app/node_modules/miller-rabin/test/api-test.js
tang-0.1.0 spec/tang_app/node_modules/miller-rabin/test/api-test.js
tang-0.0.9 spec/tang_app/node_modules/miller-rabin/test/api-test.js
enju_library-0.3.8 spec/dummy/node_modules/miller-rabin/test/api-test.js
ilog-0.4.1 node_modules/miller-rabin/test/api-test.js