Skip to content

Instantly share code, notes, and snippets.

View miafoo's full-sized avatar
🐙

Mia miafoo

🐙
View GitHub Profile
@miafoo
miafoo / AesUtil.js
Created April 14, 2020 06:56 — forked from AndiDittrich/AesUtil.js
Node.js - AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt
// AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt
// ----------------------------------------------------------------------------------------
// the encrypted datablock is base64 encoded for easy data exchange.
// if you have the option to store data binary save consider to remove the encoding to reduce storage size
// ----------------------------------------------------------------------------------------
// format of encrypted data - used by this example. not an official format
//
// +--------------------+-----------------------+----------------+----------------+
// | SALT | Initialization Vector | Auth Tag | Payload |
// | Used to derive key | AES GCM XOR Init | Data Integrity | Encrypted Data |

Keybase proof

I hereby claim:

  • I am mikfoo on github.
  • I am mikfoo (https://keybase.io/mikfoo) on keybase.
  • I have a public key ASBjATCPqVmAmhmmngM3EclCAbFkKjhs-r3eCGkBeFCxUgo

To claim this, I am signing this object: