1.2.0 • Published 1 year ago

@dxrry/tea-encryptor v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

tea-encryptor

A TeaEncryptor for encrypting and decrypting text into numbers using a custom character set and offset key.

Installation

You can install @dxrry/tea-encryptor via npm:

npm install @dxrry/tea-encryptor

Usage

import TeaEncryptor from '@dxrry/tea-encryptor';

// Create a new TeaEncryptor instance
const encryptor = new TeaEncryptor();

// Encrypt text
const encryptedText = encryptor.enc('Hello World');

// Decrypt text
const decryptedText = encryptor.dec(encryptedText);

console.log('Encrypted:', encryptedText);
console.log('Decrypted:', decryptedText);

Running Tests

You can run tests using npm:

npm run test

This will run the test script located at tests/test.js, which will encrypt and decrypt a sample text and output the results.

Expected output:

> @dxrry/tea-encryptor@1.0.0 test
> node tests/test.js

Encrypted Text: 168122113111113118105116182173109128124182132134134138
Decrypted Text: Original Text 1337

API

new TeaEncryptor([defaultBaseKey], [offsetKey])

Creates a new TeaEncryptor instance.

  • defaultBaseKey (optional): The default base key for encryption.
  • offsetKey (optional): The offset key used for generating the final base key.

TeaEncryptor.set(defaultBaseKey, [offsetKey])

Sets the base key and flipped base key for encryption and decryption.

  • defaultBaseKey: The default base key for encryption.
  • offsetKey (optional): The offset key used for generating the final base key.

TeaEncryptor.enc(textInput)

Encrypts the input text using the base key.

  • textInput: The text to be encrypted.

Returns the encrypted text.

TeaEncryptor.dec(textInput)

Decrypts the input text using the base key.

  • textInput: The text to be decrypted.

Returns the decrypted text.

Btw

This repository is a OSS Project for tea.xyz.

License

This project is licensed under the MIT License - see the LICENSE file for details.

1.2.0

1 year ago

0.1.0

1 year ago

0.0.1

1 year ago

1.0.0

1 year ago