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

aes-encryption-with-iv

v1.3.1

Published

This package allows you to use different algorithms for IV key in AES encryptions.

Downloads

16

Readme

AES Encryption with IV

Thanks to this package, you can perform AES encryption type with simpler and different security algorithms. It is not dependent on any 3rd party library. It runs functions from the crypto library of Node JS. AES encryption has an important place today. It is a type of encryption that I use especially in data transfers with its strong algorithm. This is how you can make transactions more secure with this encryption type.

Install

npm i aes-encryption-with-iv

or

yarn add aes-encryption-with-iv

Usage

Configuration

There are 2 config parameters. One of them is the type parameter and the other is the output parameter.The type parameter prompts you for an aes encryption type. output, on the other hand, asks what type (hex or base64) the output and input will be. Example;

{
   type: "aes-256-cbc",
   output: "base64"
}

:warning: output is an optional parameter. type is required.

You must define the config file when constructing the class. E.g;

const AESProvider = require("aes-encryption-with-iv");
var libAES = new AESProvider({
	type: "aes-256-cbc",
	output: "base64"
});

Functions

| Function name | Description | | ---------------------------- | ------------------------------ | | Encryption(data, key) | It encrypts the data, IV Key is generated automatically. | | Decryption(data, key) | Decrypts data. The encrypted data must be derived from the Encrypt(data, key) function. | | EncryptionWithIV(data, key, ivkey) | It encrypts the data, It is not a recommended function. | | DecryptionWithIV(data, key, ivkey) | Decrypts data. The encrypted data must be derived from the DecryptionWithIV(data, key, ivkey) function. | | EncryptionDifferenceAlgo(data, key) | It performs encryption by hiding the IV Key. | | DecryptionDifferenceAlgo(data, key) | Decrypts data. The encrypted data must be derived from the DecryptionDifferenceAlgo(data, key) function. |

EncryptionDifferenceAlgo(data, key) and DecryptionDifferenceAlgo(data, key)

The main purpose of this function is to make the iv key value more undetectable. By standard your IV key (CBC is the best example) should be 16 bytes. The relevant IV key is divided into 2 equal parts and combined with the front and back ends. In the encryption solution, the first 16 (because it is hex type) and the last 16 values on the front and back ends are taken. This result returns us the IV Key. The data in the middle is our encrypted data. This encrypted data is decrypted with standard crypto functions.

Recommended

  • The tests were generally done in 256-cbc type. You can create an issue for the problem to be experienced in different algorithms.
  • All functions are asynchronous. It returns Promise<string> to you.
  • Compiled in v16.13.2 version of nodejs.
  • Since it is in beta stage, please report any errors including the document.

Planned in Future Releases

  • [x] npm release
  • [x] examples
  • [ ] file encryption
  • [ ] aes encrypted data transfer via nodejs with different languages

Quick Example

const AESProvider = require("aes-encryption-with-iv");
var libAES = new AESProvider({
    type: "aes-256-cbc",
    output: "hex"
});

var MyData = "This my very secret data!";
var MyKey = "cGceKQLGHjdwsm3FxKC7WzNuYKqZKSYF";

(async () => {
    var EncryptedOutput = await libAES.EncryptionDifferenceAlgo(MyData, MyKey);
    console.log(EncryptedOutput);
    var DecryptedOutput = await libAES.DecryptionDifferenceAlgo(EncryptedOutput, MyKey);
    console.log(DecryptedOutput);
})();

Output

fec4c731ef630bb9f0a76e21ba291003438540f9463fbeffeed5a850645b160a36ef6013b5150b795ff2d52bddddc789
This my very secret data!

Collaborations

You can send a PR for collaboration or report a bug. For paid works, please use my e-mail address https://halilhanbadem.dev/contact/