Jump to content

RSA encryption


Sigmahokies

Recommended Posts

Hello everyone,

I'm trying to create a RSA encryption, but seem it is not function correctly.

Is Javascript know RSA? like, let rsa = new RSA(); do I have to download from github? 

here my code:

	                    let rsa = new RSA();
                    let prime = ["2", "3", "5", "7", "11", "13"]  //<-- Prime number
                    let random = prime[Math.floor(Math.random() * prime.length)];
                    let text = document.getElementById("readed");
                    document.getElementById("en").innerHTML = rsa.encrypt(random, text);
	

Seem  console log show it is not function.

Edited by Sigmahokies
Link to comment
Share on other sites

RSA is not a native Javascript object, you will have to find a library. Wherever you found that code should have some documentation telling you where to get the library.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...