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.

175 lines
1.6 KiB

  1. # jsbn: javascript big number
  2. [Tom Wu's Original Website](http://www-cs-students.stanford.edu/~tjw/jsbn/)
  3. I felt compelled to put this on github and publish to npm. I haven't tested every other big integer library out there, but the few that I have tested in comparison to this one have not even come close in performance. I am aware of the `bi` module on npm, however it has been modified and I wanted to publish the original without modifications. This is jsbn and jsbn2 from Tom Wu's original website above, with the modular pattern applied to prevent global leaks and to allow for use with node.js on the server side.
  4. ## usage
  5. var BigInteger = require('jsbn');
  6. var a = new BigInteger('91823918239182398123');
  7. alert(a.bitLength()); // 67
  8. ## API
  9. ### bi.toString()
  10. returns the base-10 number as a string
  11. ### bi.negate()
  12. returns a new BigInteger equal to the negation of `bi`
  13. ### bi.abs
  14. returns new BI of absolute value
  15. ### bi.compareTo
  16. ### bi.bitLength
  17. ### bi.mod
  18. ### bi.modPowInt
  19. ### bi.clone
  20. ### bi.intValue
  21. ### bi.byteValue
  22. ### bi.shortValue
  23. ### bi.signum
  24. ### bi.toByteArray
  25. ### bi.equals
  26. ### bi.min
  27. ### bi.max
  28. ### bi.and
  29. ### bi.or
  30. ### bi.xor
  31. ### bi.andNot
  32. ### bi.not
  33. ### bi.shiftLeft
  34. ### bi.shiftRight
  35. ### bi.getLowestSetBit
  36. ### bi.bitCount
  37. ### bi.testBit
  38. ### bi.setBit
  39. ### bi.clearBit
  40. ### bi.flipBit
  41. ### bi.add
  42. ### bi.subtract
  43. ### bi.multiply
  44. ### bi.divide
  45. ### bi.remainder
  46. ### bi.divideAndRemainder
  47. ### bi.modPow
  48. ### bi.modInverse
  49. ### bi.pow
  50. ### bi.gcd
  51. ### bi.isProbablePrime