Skip to content

Instantly share code, notes, and snippets.

@tianhaoz95
Created February 27, 2020 04:15
Show Gist options
  • Save tianhaoz95/e413a8415dc6c4ea0399208605306bb8 to your computer and use it in GitHub Desktop.
Save tianhaoz95/e413a8415dc6c4ea0399208605306bb8 to your computer and use it in GitHub Desktop.
Lines to encrypt messages
crypto.Key key = crypto.Key.fromUtf8(padCryptionKey(token));
crypto.IV iv = crypto.IV.fromLength(16);
crypto.Encrypter encrypter = crypto.Encrypter(crypto.AES(key));
crypto.Encrypted encrypted = encrypter.encrypt(msg, iv: iv);
msg = encrypted.base64;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment