[p5.js] How to use 'CryptoJS'

How to use ‘CryptoJS’

  1. Add library
    <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script>

  2. Add code

var encrypted = CryptoJS.AES.encrypt(myString, myPassword);
var decrypted = CryptoJS.AES.decrypt(encrypted, myPassword).toString(CryptoJS.enc.Utf8);

It works fine!

1 Like