Created
November 4, 2019 15:16
-
-
Save adamTrz/85a1591db9110b8a7d317c634a2b4f89 to your computer and use it in GitHub Desktop.
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
| const encrypt = (text: string) => { | |
| const textBytes = aes.utils.utf8.toBytes(text); | |
| const aesCtr = new aes.ModeOfOperation.ctr(aes256key); | |
| const encryptedBytes = aesCtr.encrypt(textBytes); | |
| const encryptedHex = aes.utils.hex.fromBytes(encryptedBytes); | |
| return encryptedHex; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment