2.1.5 • Published 1 year ago

encrypt-rsa v2.1.5

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Encrypt By RSA Algorithm

npm version  https://img.shields.io/npm/dm/encrypt-rsa.svg

This package works fine with web browsers and servers

RSA is a public-key cryptoSystem that is widely used for secure data transmission. It is also one of the oldest. The acronym RSA comes from the surnames of Ron Rivest, Adi Shamir and Leonard Adleman, who publicly described the algorithm in 1977. Wikipedia

RSA algorithm is asymmetric cryptography algorithm. Asymmetric actually means that it works on two different keys i.e. Public Key and Private Key. As the name describes that the Public Key is given to everyone and Private key is kept private.

For more explanation about RSA Algorithm visit

  1. Installation
  2. Usage

Installation

  npm i encrypt-rsa --only=production
  // OR
  yarn add encrypt-rsa --only=production

Usage

import EncryptRsa from 'encrypt-rsa';

//OR

const EncryptRsa = require('encrypt-rsa').default;

// create instance
const encryptRsa = new EncryptRsa();

Create Private and Public keys

const { privateKey, publicKey } = nodeRSA.createPrivateAndPublicKeys();

Encrypt Text

const encryptedText = encryptRsa.encryptStringWithRsaPublicKey({ 
  text: 'hello world',   
  publicKey,
});
console.log(encryptedText);

// QMPLJN3KzvXxkll18wax+KxqC0UqiHrwMxYGNUmJWMi98diapGOL/WzliPP3bTrHu7yWU1DnaB3f71w6JBYP+wG98fWLaz8+rwemerVja8B0FJVUphjBUmoDhX52JSoLFI0YVHtihXtoRk1pVaRFWm8FmZPZAcCKL7a0YDI1wABGvcSbLhaacmgX6zR6fzyltWVCrXn0NcVGox7WK7x4sCtywNhZx2XuUVSztr7QYcV2OQe8aDTUd7NXtaBVkj9RUYUR2QvhIpETksx14WD4ytohM68RUIJLRmU3y761mxcF+7Pjw/Utcirqu2Ohg0K18xGqlaE6fdifh0vIlfH+kA==

Decrypt Encrypted Text

const decryptedText = nodeRSA.decryptStringWithRsaPrivateKey({ 
  text: encryptedText, 
  privateKey
});
console.log(decryptedText);
// hello world

Rsa Algorithm:

Contributions

feel free to open an issue and make a pull request

2.1.5

1 year ago

2.1.4

1 year ago

2.1.2

2 years ago

2.1.1

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.2.0

2 years ago

1.2.1

2 years ago

1.1.0

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.12

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.9

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago