Skip to content

Instantly share code, notes, and snippets.

View crotel's full-sized avatar
😉
have a good day~

CROTEL crotel

😉
have a good day~
View GitHub Profile
@crotel
crotel / rsa.js
Created November 28, 2022 14:30 — forked from sohamkamani/rsa.js
An example of RSA Encryption implemented in Node.js
const crypto = require("crypto")
// The `generateKeyPairSync` method accepts two arguments:
// 1. The type ok keys we want, which in this case is "rsa"
// 2. An object with the properties of the key
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", {
// The standard secure default length for RSA keys is 2048 bits
modulusLength: 2048,
})