Giter Site home page Giter Site logo

abdallahkadour / burningpig-encryption Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joedoyle23/burningpig-encryption

0.0 0.0 0.0 18 KB

A pure javascript module for the RSA functionality for BurningPig & Minecraft encryption

License: Other

JavaScript 100.00%

burningpig-encryption's Introduction

BurningPig-encryption

A pure javascript module for the RSA functionality for BurningPig & Minecraft encryption

What does it do?

This module can generate an RSA public/private key pair in pure JavaScript. It can also generate the ASN.1 for the key.

Is it cryptographically safe?

I have no idea. I only use it for implimenting the encryption for the Minecraft protcol. I don't use it for any important encryption scenarios.

What is it based on?

This module is adapated for Node.js from the following libraries:

Example:

You can run this example by running node example

var rsa = require("./src/rsa.js");
var key = new rsa.Key();

var message = "All your bases are belong to us.";
console.log("Message:\n"+message+"\n");

// Generate a key
key.generate(1024, "10001");
console.log("Key:\n");
console.log("n:" + key.n.toString(16));
console.log("e:" + key.e.toString(16));
console.log("d:" + key.d.toString(16));
console.log("\n");

// Encrypt
var encrypted = key.encrypt(message);
console.log("Encrypted:\n" + rsa.linebrk(encrypted, 64) + "\n" );

// Decrypt
var decrypted = key.decrypt(encrypted);
console.log("Decrypted:" + rsa.linebrk(decrypted, 64) + "\n");

var sig = key.signString(message, "sha256");
console.log("String signature: \n" + rsa.linebrk(sig, 64));

var pubkey = new rsa.Key();
pubkey.n = key.n;
pubkey.e = key.e;

var verified = pubkey.verifyString(message, sig);

console.log("Verfied: " + verified);

License

BurningPig-encryption & the base libraries are MIT licensed.

See the LICENSE file for the list of specific licenses for each library

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.