Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

mdjfs/CryptoRSA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

7 Commits

Repository files navigation

CryptoRSA

encrypt/decrypt your binary buffers in JavaScript

How to Install

  • Download:
    • Normal: Download the release and copy "CryptoRSA.js" in the folder of your project
    • Clone: insert the git bash command:
git clone https://github.com/mdjfs/CryptoRSA.git
  • Install: Add references for JavaScript file in your html like this:
<script src="CryptoRSA.js"/>

Usage

Call a instance of CryptoRSA with this line of code:

var crypto = new CryptoRSA(private_key, public_key);

param private_key = Insert array with two numbers primes greater than 16 bits (your private key). For example: [38501, 45541] This key is needed to decrypt binaries

param public_key = Insert a number result of the multiplication of the two previous numbers (your public key). For example: 1753374041 (38501 * 45541) This key is needed to encrypt binaries

For example:

var crypto = new CryptoRSA([38501, 45541], 1753374041);

please, use your own numbers in your tests

You can also insert only public_key or private_key, examples:

var crypto = new CryptoRSA([38501, 45541]);
var crypto = new CryptoRSA(null, 1753374041);

How to encrypt? You can encrypt strings, numbers, files, etc.. But you need transform this in ArrayBuffer, after this, you can call a method CryptoRSA.encrypt to encrypt the ArrayBuffer, Example:

var result = crypto.encrypt(my_array_buffer);

This method returns a array of decimal numbers encoded

How to decrypt? You can call a method CryptoRSA.decrypt to decrypt the ArrayBuffer, Example:

var my_array_buffer = crypto.decrypt(result);

This method returns the original array buffer

About

encrypt/decrypt your binary buffers in JavaScript with RSA algorithm

Resources

Stars

Watchers

Forks

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /