@geeleed/cryptor16
TypeScript icon, indicating that this package has built-in type declarations

2.1.2 • Public • Published

cryptor16

Encrypt and decrypt text using the @geeleed/cryptor16 library.

For backend

Installation

Install the package from npm:

npm i @geeleed/cryptor16

Usage To run tests, use the following command:

npm run test

Description cryptor16 is a simple algorithm for encrypting and decrypting text using a key. This project is developed purely for hobby purposes.

Example

const cryptor16 = require('@geeleed/cryptor16');

const key = 'your-secret-key';
const text = 'Hello, World!';

const encryptedText = cryptor16.encryption(text, key);
console.log('Encrypted:', encryptedText);

const decryptedText = cryptor16.decryption(encryptedText, key);
console.log('Decrypted:', decryptedText);

Remember to replace 'your-secret-key' with your actual secret key.

For frontend

use index-client.js and crypto-js-4-1-1.js in folder client

    <script src="client/crypto-js-4-1-1.js"></script>
    <script src="client/index-client.js"></script>

example

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Cryptor16</title>
  </head>
  <body>
    <main>
      <h1>Demo cryptor16 in Frontend</h1>
      <input type="text" id="text" placeholder="Your text data" />
      <input type="password" id="key" placeholder="Your key" />
      <button onclick="encrypt()">Encrypt</button>
      <button onclick="decrypt()">Decrypt</button>
      <p id="display"></p>
    </main>
    <script src="client/crypto-js-4-1-1.js"></script>
    <script src="client/index-client.js"></script>
    <script>
      const text = document.getElementById("text");
      const key = document.getElementById("key");
      const p = document.getElementById("display");

      function encrypt() {
        p.innerText = window.encryption(text.value, key.value, 6);
      }

      function decrypt() {
        p.innerText = window.decryption(text.value, key.value, 6);
      }
    </script>

  </body>
</html>

Readme

Keywords

none

Package Sidebar

Install

npm i @geeleed/cryptor16

Weekly Downloads

1

Version

2.1.2

License

ISC

Unpacked Size

118 kB

Total Files

9

Last publish

Collaborators

  • geeleed