Skip to content

new BigInteger() very slow during generation of rsa key #7

@akyGit

Description

@akyGit

I have a trouble with performance during generation of key 2048 bit.
This process can spend from 3 minutes to 14-15.
Therefore I would like to know, what exactly spend time.
It was BigInteger constructors in rsa generate method. (src/crypto/public_key/rsa.js)
call of new BigInteger() can spend from 2 to 5 minutes.

Smartphone:

  • Android 6.0.1;
  • ASUS Zenfone (ZD551KL);
  • processor Qualcomm MSM8939 Snapdragon 615 + Adreno 405;
  • RAM 3072MB.

Project dependencies:

  • "react": "15.4.2"
  • "react-native": "0.42.3"
  • "react-native-openpgp": "^1.0.3"

Code snippet:

      const optionsGenerateKey = {
        userIds: [{ name:'FirstName LastName', email:'first.last@gmail.com' }],
        numBits: 2048,
        passphrase: 'password',
      };

      console.warn('prepare random values...');
      await openpgp.prepareRandomValues();

      console.warn('keys generation...');
      const start = Date.now();
      const key = await this.generateKey(optionsGenerateKey);
      const end = Date.now();
      console.warn((end - start) / 1000);``` 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions