# rncryptor

> JavaScript implementation of RNCryptor

Latest version **0.1.1** (published 2022-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install rncryptor
pnpm add rncryptor
yarn add rncryptor
bun add rncryptor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2022-09-11 |
| First published | 2022-09-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mumtaz Aziz |
| Maintainers | mumtazaziz05 |
| Keywords | rncryptor |

## Links

- npm: https://www.npmjs.com/package/rncryptor
- Repository: https://github.com/unseb/node-rncryptor
- Homepage: https://github.com/unseb/node-rncryptor#readme
- Issues: https://github.com/unseb/node-rncryptor/issues
- npm.io page: https://npm.io/package/rncryptor

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2022-09-11
- 0.1.0 — 2022-09-11

## README

# node-rncryptor

JavaScript implementation of RNCryptor

## Supported formats

| Format version | Encryption method         |
| :------------: | :------------------------ |
|       2        | Key based, Password based |
|       3        | Key based, Password based |

## Usage

This package attempts to emulate the Node.js crypto API. You can see how similar `createPasswordEncryptor` is to `createCipheriv`:

```javascript
const { createPasswordBasedEncryptor } = require("rncryptor");

const original = "The quick brown fox jumps over a lazy dog. 1234567890";
const password = "123456";

const encryptor = createPasswordBasedEncryptor(password);

let encrypted = encryptor.update(original, "utf-8", "hex");
encrypted += encryptor.final("hex");

console.log(encrypted);
```

This also applies to the corresponding decryptors:

```javascript
// ...
const { createPasswordBasedDecryptor } = require("rncryptor");

const decryptor = createPasswordBasedDecryptor(password);

let decrypted = decryptor.update(encrypted, "hex", "utf-8");
decrypted += decryptor.final("utf-8");

console.log(decrypted);
// Prints: The quick brown fox jumps over a lazy dog. 1234567890
```

### Use specific version format

By default, RNCryptor uses the latest format version when encrypting and automatically guesses the version format when decrypting. If you want to use specific format version, append the format version while importing:

```javascript
const {
  createPasswordBasedEncryptor
  createPasswordBasedDecryptor
} = require("rncryptor").v2;
```

## Todos

- Migrate to TypeScript
- Add inline JSDoc
- Add unit tests
- Add v4 support

---
_Source: https://npm.io/package/rncryptor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
