Skip to content

Instantly share code, notes, and snippets.

@mixinmax
mixinmax / rsa-decrypt.js
Created March 12, 2015 19:23
Takes the binary output from rsa-encrypt.js and checks the signature, decrypts the symmetric key, and decrypts the message
'use strict';
// set up required modules
var fs = require('fs');
var args = require('minimist')(process.argv.slice(2));
// the ursa module is imported to wrap OpenSSL and provide RSA decryption for
// the digital signing aswell as decrypting the symmetric key. URSA cannot do
// symmetric decryption natively, so we need another module for that
var ursa = require('ursa');
@mixinmax
mixinmax / rsa-encrypt.js
Last active July 24, 2019 02:45
Uses 256-bit AES to encrypt a file which is signed using RSA. The ciphertext, RSA encrypted AES key and the signature are concatenated into a binary file to be used in rsa-decrypt.js
'use strict';
// set up required modules
var fs = require('fs');
var args = require('minimist')(process.argv.slice(2));
// the ursa module is imported to wrap OpenSSL and provide RSA encryption for
// the digital signing aswell as encrypting the symmetric key. URSA cannot do
// symmetric encryption natively, so we need another module for that
var ursa = require('ursa');
@mixinmax
mixinmax / atmega2560-arch
Last active August 29, 2015 14:13
ATMega2560 Architecture Overview
General
-------
- 32 general purpose registers
- Address bus is 17 bits
- Address is 16 bits
- Instructions are 2 or 4 bytes
- Flash address space 0x0 to 0x1FFFF
- Program counter is 17 bits
Ports & Pins