You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

api-test.js 694B

123456789101112131415161718
  1. var assert = require('assert');
  2. var mr = require('../').create();
  3. var bn = require('bn.js');
  4. describe('Miller-Rabin', function() {
  5. it('should test number for primality', function() {
  6. assert(!mr.test(new bn(221)));
  7. assert(mr.test(new bn(257)));
  8. var p = new bn('dba8191813fe8f51eaae1de70213aafede8f323f95f32cff' +
  9. '8b64ebada275cfb18a446a0150e5fdaee246244c5f002ce0' +
  10. 'aca97584be1745f2dd1eea2849c52aac8c4b5fb78a1c4da7' +
  11. '052774338d3310a6e020c46168cb1f94014e9312511cc4fb' +
  12. '79d695bb732449f0e015745b86bfa371dc6ca7386e9c7309' +
  13. '5549c2e4b8002873', 16);
  14. assert(mr.test(p));
  15. });
  16. });