Hello. You can easily create web pages through ‘p5.js’. good.
However, I am curious about one thing. Can’t you hide the code?
If you press the ‘F12’ button after implementing the WEB Page, the source code is displayed.
The source code appears as the original.
If you are concerned that visitors to the web page might see strings that contain sensitive information, you could consider encryption. However, since it is the browser that executes the JavaScript code, a highly motivated user could still get access to the code, and work at getting at the sensitive information.
Are you hosting the web pages on a server that you control? If so, you could hide a lot of the logic by using a web framework, such as Flask. See:
With Flask, you would use Python to create web pages. Much or all of the sensitive logic could be performed behind the scenes. You could still use p5.js to perform the graphics.
The p5.js library is all JavaScript. You would be serving that library, your script, some HTML, and probably some CSS. You might also be serving some data, such as JSON. Which of those would you like to encrypt?
You could certainly use CryptoJS within a p5.js script. However, we need to see an example of code that you are trying to get to work.
In your HTML file, try this:
Link to the CryptoJS library.
Link to the p5.js library.
Link to your sketch script.
If you could provide us with an HTML file and a sketch to exemplify what you are trying to do, we can try to help. However, if you are trying to encrypt JavaScript code itself, and hope to have the browser execute it without making the code accessible to a visitor to the web page, that may be difficult or impractical. I don’t feel able to do that, but perhaps someone else can offer suggestions.
You could put the p5.js and the CryptoJS libraries in the libraries folder. That libraries folder could be within the same folder as your sketch. Just let us know how you have configured the files when providing us with example code.
Is there a good CryptoJS discussion group? It seems that this may be more of a CryptoJS issue than a p5.js one. A CryptoJS discussion group might be a venue where you can find expertise for good advice regarding this topic. If you do post a query concerning this issue on such a forum, please provide us a link to the post. They may also benefit if you provide a link from that post back to this discussion.
What I want is to run ‘CryptoJS.AES’ in the ‘p5.js’ space.
If operation is possible, it is likely that several variables can be encrypted.
And it looks like it could be complicated.
You can check the method through ‘JS’ at ‘google’.
But I want to utilize ‘p5.js’ for this, but I don’t know how.