Created
February 27, 2020 04:15
-
-
Save tianhaoz95/e413a8415dc6c4ea0399208605306bb8 to your computer and use it in GitHub Desktop.
Lines to encrypt messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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