openssl-ha
TypeScript icon, indicating that this package has built-in type declarations

1.0.13 • Public • Published

OpenSSL-HA

OpenSSL-HA is based off of the native OpenSSL library and will provide functionality of the widely adopted AES-256 and HS-256 algorithms.

Features

  • AES-256 encryption and decryption
  • HS-256 hashing

Installation

npm install openssl-ha

Usage

import { encryptAes256, decryptAes256, encryptHs256 } from 'openssl-ha';

// Encrypt a message with AES-256
const message = 'Hello, World!';
const key = '3nCrYpT10nK3y!';
const encryptedMessage = encryptAes256(message, key);
console.log('Encrypted Message:', encryptedMessage);

// Decrypt the encrypted message with AES-256
const decryptedMessage = decryptAes256(encryptedMessage, key);
console.log('Decrypted Message:', decryptedMessage);

// Generate an HS-256 hash
const hash = encryptHs256(message, key);
console.log('Hash:', hash);
  • Note: Versions lower than 1.0.0 are not recommended

API

  • encryptAes256(message: string, key: string): string

    • Encrypts a message using the AES-256 algorithm with the provided key and returns the encrypted ciphertext.
  • decryptAes256(ciphertext: string, key: string): string

    • Decrypts a ciphertext using the AES-256 algorithm with the provided key and returns the original message.
  • encryptHs256(message: string, key: string): string

    • Generates an HS-256 hash of the message using the provided key and returns the hash value.

License

This project is licensed under the MIT License.

Dependencies (0)

    Dev Dependencies (10)

    Package Sidebar

    Install

    npm i openssl-ha

    Weekly Downloads

    2

    Version

    1.0.13

    License

    MIT

    Unpacked Size

    57.1 kB

    Total Files

    5

    Last publish

    Collaborators

    • nhahan