🚀 NodeJS

const crypto = require("crypto");
const cipher = crypto.createCipheriv("aes-256-cbc", crypto.randomBytes(32), crypto.randomBytes(16));
crypto is a built-in module

In NodeJS, it's this simple to create a cipher! The randomBytes function creates random keys for you, instead of plain old letters, numbers, and/or symbols.

🐍 Python

from Crypto.Cipher import AES
import os
cipher = AES.new(os.urandom(16), AES.MODE_CBC, os.urandom(16))
pip install pycrypto

In python, the PyCrypto library doesn't provide a random bytes function — the built-in os library does. Other than that, the syntax is the same as NodeJs.

Built With

Share this project:

Updates