Warning: This library is not production-ready and is still in alpha. Use with caution and expect breaking changes.
cryptjs
is a JavaScript/TypeScript library that brings cryptographic
functionality from Dart to the web. It is a port of Dart's cryptography
libraries, allowing you to perform various cryptographic operations such as
hashing, encryption, and decryption, all within your JavaScript/TypeScript
projects.
- Hashing: SHA-256, SHA-512.
- Ported from Dart: Brings Dart's reliable cryptography to JavaScript/TypeScript
pnpm install @abdellatif.dev/cryptjs
npm install @abdellatif.dev/cryptjs
yarn add @abdellatif.dev/cryptjs
Once installed, you can import and use cryptjs
in your JavaScript/TypeScript
code.
const Cryptjs = require("@abdellatif.dev/cryptjs");
/** @type {string} */
const message = "Hello, world!";
/** @type {string} */
const salt = "Salt";
/** @type {Cryptjs.Sha} */
const hash = Cryptjs.sha512(message, salt);
console.log("SHA-512 Hash:", hash.toString());
import Cryptjs from "@abdellatif.dev/cryptjs";
const message: string = "Hello, world!";
const salt: string = "Salt";
const hash: Cryptjs.Sha = Cryptjs.sha512(message, salt);
console.log("SHA-512 Hash:", hash.toString());
const Cryptjs = require("@abdellatif.dev/cryptjs");
/** @type {string} */
const message = "Hello, world!";
/** @type {string} */
const salt = "Salt";
/** @type {Cryptjs.Sha} */
const hash = Cryptjs.sha256(message, salt);
console.log("SHA-256 Hash:", hash.toString());
import Cryptjs from "@abdellatif.dev/cryptjs";
const message: string = "Hello, world!";
const salt: string = "Salt";
const hash: Cryptjs.Sha = Cryptjs.sha256(message, salt);
console.log("SHA-256 Hash:", hash.toString());
- SHA-256.
- SHA-512.
Contributions are welcome! If you have an idea for an improvement or find a bug, please fork the repository and submit a pull request.
- Fork the repository
- Clone your fork locally
- Make your changes or fix bugs
- Ensure that tests are passing (if applicable)
- Submit a pull request
cryptjs
is open source software, licensed under the MIT License. See the
LICENSE file for more information.
This project is a port of Dart's cryptography libraries to JavaScript/TypeScript, and it leverages established cryptographic algorithms to ensure security and reliability.
- The library name (
cryptjs
) is used throughout. - It starts with an overview of features.
- Shows how to install and use it.
- Includes API references and code examples for common cryptographic functions.
- Encourages contributions from other developers.
You can adjust the examples, features, and details depending on the specific functions your library supports!
- [x] add sha256
- [x] types support
- [ ] make salt optional and generate salt
- [ ] secure random and not secure random
- [ ] add min and max rounds
const minRounds = 1000;
const maxRounds = 999999999;
const defaultRounds = 5000;
- [ ] tests use something like
jest