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

simenc

v2.0.4

Published

A tool for encryption *will be used in heed*

Downloads

4

Readme

Simenc

Installation

Install it from npm package manager using this command in cmd :

npm i simenc

It also contains typescript files. So if you want to use them install it locally use :

npm init
npm i --save simenc

Unique Features

Simple to use

Fast and user friendly

See examples to know why it is best ?

best for beginners

Usage

In Javascript

var sim = require("simenc")
var {encrypt,decrypt} = sim //write all things you need in {}
//by default encryption and decryption type is AES

var data = "it is data."
var key = "it is a key."

var encdata = encrypt(data,key)

console.log(encdata.toString())	//console encrypted data
console.log(decrypt(encdata,key)) //console decrypted data

In typescript :

import * as sim from "simenc";
var {encrypt,decrypt} = sim;

var data = "it is data."
var key = "it is a key."

var encdata = encrypt(data,key)

console.log(encdata.toString())	//console encrypted data
console.log(decrypt(encdata,key)) //console decrypted 

Limitations

It does not allow you to Utf8 to Utf16 or anything else.The default encoding for data is Utf8. You can't set iv,padding or anything else while encrypting.But whatever, These things does not matter so much ans also they will resolved in future.These are not added because i want beginners to use this and most of the beginners don't know about padding or iv. Also, it is not only for beginners it is for everyone who want to secure their data.

Future

In the future most of other features will be added like : diffie hellman, changing encoding type, using iv and other properties of encryption.In the future i will launch a version of it for python and java.So,keep awaited because we make cryptography easy.

Docs

It is built using module Crypto-js but it is more simplified than it.

defaults

Encryption type : AES
Decryption type : AES
Hash type : SHA256
encoding : Utf8

importing and using

to see its installation click here! you can import it like that :

var sim = require("simenc");
console.log(sim.SHA256("this is a text"));

but then it will take more time to write code as you hove to use sim. before everything you need. So more nice way to do this is to firstly import everything that you need and then use it. For ex :

var sim = require(simenc);
var data = "this is a text";

//imports
var {encrypt,hash,SHA512,random,decrypt,MD5} = sim;

console.log(encrypt(data,hash(data)).toString());

When you encrypt the data it outputs the encryted data in form of object. So, to see the data you have to parse it into string using .toString() . On the other hand when you have to decrypt the data you don't have to use the data pared into string, You must the the encrypted data you got as object.

Random

It is used to get the random data which you can use to get salt or any other thing. Code :

var sim = require(simenc);
var data = "this is a text";

//imports
var {encrypt,hash,SHA512,random,decrypt,MD5} = sim;

console.log(random(4,"string"));

It has 2 parameters (length,type). Length can be anything but type takes only 3 values string,number,hashed. String : It generates a random string of characters. Number : It generates a random number. Hashed : It generates a hashed value of random characters.

I recommend to generate firstly generate a string of random characters and then hash it.

Encryption & Decryption

When you encrypt the data it outputs the encryted data in form of object. So, to see the data you have to parse it into string using .toString() . On the other hand when you have to decrypt the data you don't have to use the data pared into string, You must use the encrypted data you got as object while decrypting.

Types

AES || DES || TripleDES || RC4 || RC4Drop || Rabbit || RabbitLegacy

Decryption type are also same but you have to add dec before writing type.

Crypto-js

You can use crypto-js directly from this module. Using

var sim = require("simenc");
var CryptoJS = sim.crypto;

//you can use Cryptojs module now

See their documentation also.

Browser Support

It gives support to browser also. to access it do the following steps:

npm init
npm i simenc

You will see a folder created inside node_modules/simenc named as dist.It contains all files for browser support.

<html>
	<head>
	</head>
	<body>
		<script src="./node_modules/simenc/dist/simenc_browser.js"></script>
		<script>
			var sim = require("simenc");
			var {hash,encrypt,decrypt} = sim;
			console.log(hash("it is a data"));
		</script>
	</body>
</html>

About Us

Creators

Mridul Thakur

License

MIT