npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rc4a

v0.1.2

Published

Simple text-password advanced encryption & decryption UTF-8 algorithm based on alleged RC4. NodeJS, JavaScript, PHP compatible.

Downloads

11

Readme

RC4A.js v0.1.2

NodeJS/JavaScript implementation of simple and powerfull string encryption/decryption with the password & UTF-8 support. You can encrypt string in the browser and decrypt it on the PHP-server. Or encrypt on the PHP-server and decrypt in browser.

###Go to RC4A for PHP on GitHub

No dependecies! No OpenSSL required. Javascript, NodeJS, PHP compatible.

How to use in project

JavaScript:

<script src="rc4a.min.js" type="text/javascript"></script>

NodeJS:

var rc4a = require("rc4a");

Encryption

var text = "Lorem ipsum 123 ёюйяъэ !№;%:?*()";
var password = "supёrP@$$w0rd";
var secret = rc4a.encrypt(text,password);
console.log(secret); // Will output something like this: ]êòd»÷€[c #hüm€Zº‰í¤˜xì“/S-ˆѲѩҴӷдӂp±⅁ÑD_»¼ú{

Decryption

var decryptedText = rc4a.decrypt(secret,password);
console.log(decryptedText); // Will output: Lorem ipsum 123 ёюйяъэ !№;%:?*()

Encryption with the custom salt

RC4A.js automatically generate random salt via Math.random(). Salt size is dynamic - from 16 up to 128. If you do not trust, you can use your own salt up to 9999-size length. Just specify it:

var customSalt = "397ba6e0085f182db7ee7f6e3515530d";
var secret = rc4a.encrypt(text,password,customSalt);

And that's it. You don't have to pass salt for the decryption.

Error catching

Do not forget about damaged data. Test your code like this:

var text = "Lorem ipsum 123 ёюйяъэ !№;%:?*()";
var password = "supёrP@$$w0rd";
var secret = rc4a.encrypt(text,password).substr(4); // let's damage this encrypted content
try{
  var decryptedText = rc4a.decrypt(secret,password); // here you will get an error
  console.log("Successfully decrypted! Decrypted text:",decryptedText);
}catch(e){
  console.log("Can\'t decrypt your data.");
}

TODO:

  • Beatiful Threw Error
  • Add streams