This is a proof-of-concept tool that lets you perform a conceptually private chat between you and another user. Of course, you have to pick from a whitelist selection of messages. The text is encrypted using the public key of the user you're sending a message to, and published (along with your username and the target's public key, so they know who sent the message and that the message was sent to them). There are all sorts of cryptographic problems with this (for example: how do you know the person you're talking to is really the person you're talking to?), but it works as a basic demo that this sort of algorithm can certainly be done in Scratch. Cloud data is a little wonky so you might have trouble actually interacting with other users, but you can message yourself if you want to test it that way.
I used the code https://scratch.mit.edu/projects/178664477/ to do modular exponentiation and the code from https://scratch.mit.edu/projects/114325292/ to do prime number generation. I read Simple Wikipedia's page on the RSA algorithm alongside JonCooperWorks's basic RSA implementation in Python as references while programming this project. https://simple.m.wikipedia.org/wiki/RSA_algorithm#A_working_example https://gist.github.com/JonCooperWorks/5314103