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

encriptorjs

v1.0.2

Published

JavaScript text encryption library for secure encryption and decryption.

Downloads

195

Readme

EncriptorJS

Visitors

EncriptorJS is a JavaScript text encryption library that allows you to securely encrypt and decrypt text. It provides a simple interface to convert your text into an encrypted form and optionally add a key for additional security. Only the correct key can be used to decrypt the text, ensuring that unauthorized access is prevented.

Installation

You can use EncriptorJS by including the library in your JavaScript project or HTML file.

In a JavaScript project

  1. Download the EncriptorJS library file (encriptor.js) from the GitHub repository.
  2. Move the encriptor.js file into your project directory.
  3. In your JavaScript file, import the EncriptorJS library:
   import Encriptor from './encriptor.module.js';

or Use

npm i encriptorjs
   import Encriptor from 'encriptorjs';

In an HTML file

  1. Download the EncriptorJS library file (encriptor.js) from the GitHub repository or NPMJS.

  2. Move the encriptor.js file into your project directory.

  3. In your HTML file, add the following script tag:

    <script src="encriptor.js"></script>

    or

    <script src="https://cdn.jsdelivr.net/gh/SH20RAJ/EncriptorJS@main/encriptor.min.js"></script>

Usage

Once you have included the EncriptorJS library in your project, you can start encrypting and decrypting text.

Encrypting Text

To encrypt text, use the encrypt method of the Encriptor object. Here's an example:

const text = 'My name is Sh';
const key = '1234';

const encryptedText = Encriptor.encrypt(text, key);
console.log(encryptedText); // Outputs: 'Kcdew9zdYidBf'

The encrypt method takes two parameters: the text you want to encrypt and an optional key for additional security. It is recommended to use only digits in the key parameter. It returns the encrypted text.

Decrypting Text

To decrypt the encrypted text, use the decrypt method of the Encriptor object. Here's an example:

const encryptedText = 'Kcdew9zdYidBf'; // Replace with the encrypted text
const key = '1234';
const decryptedText = Encriptor.decrypt(encryptedText, key);
console.log(decryptedText); // Outputs: 'My name is Sh'

The decrypt method takes two parameters: the encryptedText you want to decrypt and the key used during encryption. It returns the decrypted text.

Shuffling Strings

The EncriptorJS library also provides a utility function called shuffleString that can be used to shuffle strings using a key. Here's how you can use it:

const text = 'Hello, World!';
const shuffledText = Encriptor.shuffleString(text, 42);
console.log(shuffledText); // Outputs a shuffled version of the input string

The shuffleString function takes a text parameter as the input string and an optional key parameter used to initialize the random number generator. By using the same key, you can obtain the same shuffled result. This function can be used for encryption purposes or to shuffle strings for other applications.

Please note that the shuffleString function alone does not provide strong encryption. For secure encryption, it is recommended to use well-established encryption algorithms and libraries designed for that purpose.

Encriptor.shuffle(text) always gives different shuffled pattern.

Examples

You can find more examples in the examples directory of this repository. The examples demonstrate various use cases of the EncriptorJS library.

License

This project is licensed under the MIT License.

Refrences

https://dev.to/sh20raj/creating-a-custom-javascript-function-to-shuffle-strings-with-a-key-parameter-3c8a https://dev.to/sh20raj/introducing-encriptorjs-secure-text-encryption-and-decryption-in-javascript-a-jwt-easy-to-use-alternative-l02