Socket
Socket
Sign inDemoInstall

react-native-modpow

Package Overview
Dependencies
514
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-modpow

export native BigInteger.modPow() function that will not freeze your UX for more than a minute.


Version published
Weekly downloads
982
increased by34.71%
Maintainers
3
Install size
229 kB
Created
Weekly downloads
 

Changelog

Source

v1.1.0 : 2021/04/01

  • [enhancement] Add TypeScript typings

Readme

Source

react-native-modpow

Export native BigInteger.modPow() function that will not freeze your UX for more than a minute.

Installation

npm install react-native-modpow

Linking:

react-native link react-native-modpow

Usage

import modPow from 'react-native-modpow'

const result = modPow({
  target: 2, // number
  value: 2, // power
  modifier: 3 // Congruence
})
// result = 0

Usage as patch for Forge

Use this snippet to patch BigInteger.modPow() from node-forge. The goal is to improve Forge's performance on React-Native significantly, in particular the generation of RSA keys.

import Forge from 'node-forge'
import modPow from 'react-native-modpow'

Forge.jsbn.BigInteger.prototype.modPow = function nativeModPow (e, m) {
  const result = modPow({
    target: this.toString(16),
    value: e.toString(16),
    modifier: m.toString(16)
  })

  return new Forge.jsbn.BigInteger(result, 16)
}

Keywords

FAQs

Last updated on 02 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc