Best Function for encrypting :]

Which would be best for encrypting strings? window.crypto or window.btoa


Thanks :smile:

This is not related to Playcanvas. You will find better answer on Stackoverflow or similar.
In general, there is no best option and depends on why you need an encryption in the first place. A simple salt can be done using btoa/atob. Is it secure? Not really, but I guess better than plain text. Just keep in mind it will only support single byte characters, like latin/cyrillic, so no Asian chars.

2 Likes