Jump to content

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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...