Nautical Pirate Moustache

    modexp64

    0.1.0 • Public • Published

    modexp64

    Modular exponentiation in NodeJS using 64 bits unsigned numbers. Implemented in C++.

    Installation

    Install via npm:

    npm install modexp64 --save

    Example usage

    var modexp = require('modexp64');
     
    // 0x3E8 = 1000
    // It calcs (2^10) % 1000
    var result = modexp('2', '10', '0x3E8');
     
    // Prints 18 (in hexadecimal)
    console.log(result);
     
    // Prints 24 (in decimal)
    console.log(parseInt(result, 16));

    API Documentation

    modexp(base, exp, mod): It takes 3 strings. They can be decimal numbers or hexadecimal ones (prefixed with "0x"). It returns a string with the result in hexadecimal (with no prefix).

    Install

    npm i modexp64

    DownloadsWeekly Downloads

    4

    Version

    0.1.0

    License

    BSD

    Last publish

    Collaborators

    • ernestoalejo