# cryptorjsesm

> Encrypt and decrypt string, number and object using a key

Latest version **3.0.3** (published 2022-07-10) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.3 |
| Published | 2022-07-10 |
| First published | 2022-07-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Fabio Ricali |
| Maintainers | chiaweilee |
| Keywords | encrypt, decrypt, string, crypto, hash, password, passkey, algorithm, secret, json, object |

## Links

- npm: https://www.npmjs.com/package/cryptorjsesm
- Repository: https://github.com/fabioricali/cryptor
- Homepage: https://github.com/fabioricali/cryptor#readme
- Issues: https://github.com/fabioricali/cryptor/issues
- npm.io page: https://npm.io/package/cryptorjsesm

## Dependencies (1)

- [depreca](https://npm.io/package/depreca.md) ^1.1.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 3.0.3 (latest) — 2022-07-10
- 3.0.2 — 2022-07-10
- 3.0.1 — 2022-07-10
- 3.0.0 — 2022-07-10

## README

<div align="center">
<h1>Cryptorjs</h1>
Simple library for encryption and decryption of string, number and object using a key
<br/><br/>
<a href="https://travis-ci.org/fabioricali/Cryptor" target="_blank"><img src="https://travis-ci.org/fabioricali/Cryptor.svg?branch=master" title="Build Status"/></a>
<a href="https://coveralls.io/github/fabioricali/Cryptor?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/fabioricali/Cryptor/badge.svg?branch=master" title="Coverage Status"/></a>
<a href="https://opensource.org/licenses/MIT" target="_blank"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" title="License: MIT"/></a>
<img src="https://img.shields.io/badge/team-terrons-orange.svg" title="Team Terrons"/>
</div>

## Installation

```javascript
npm install cryptorjs --save
```

## Example
### Basic
```javascript
var cryptorjs = require('cryptorjs');

var myCryptor = new cryptorjs('yourSecretKey');

var encoded = myCryptor.encode('myExampleString');
// => '37d8e07a3dddc2971f3e53b1021f51'

var decoded = myCryptor.decode('37d8e07a3dddc2971f3e53b1021f51');
// => 'myExampleString'
```
### Object encryption
```javascript
var cryptorjs = require('cryptorjs');

var myCryptor = new cryptorjs('yourSecretKey');

var encoded = myCryptor.encode({ a: 1, b: 2 });
// => '2183c42066819ed9184f1df116'

var decoded = myCryptor.decode('2183c42066819ed9184f1df116');
// => { a: 1, b: 2 }
```

### With a cipher
For example using "camellia-256-cfb1" cipher
```javascript
var cryptorjs = require('cryptorjs');

var myCryptor = new cryptorjs('yourSecretKey', 'camellia-256-cfb1');

var encoded = myCryptor.encode('myExampleString');
// => 'ac3277ba5c3f433d6b7ea70979fe55'

var decoded = myCryptor.decode('ac3277ba5c3f433d6b7ea70979fe55');
// => 'myExampleString'
```

### Ciphers
You can get the list with a static method
```javascript
var cryptorjs = require('cryptorjs');

cryptorjs.getCiphers();

/*=> [ 'aes-128-cbc',
        'aes-128-cbc-hmac-sha1',
        'aes-128-cbc-hmac-sha256',
        'aes-128-ccm',
        'aes-128-cfb',
        'aes-128-cfb1',
        'aes-128-cfb8',...]
        */
```

### Hash helpers
Create an hash using available hashes in your platform
```javascript
var cryptorjs = require('cryptorjs');

// Check if exists MD5 hash
console.log(cryptorjs.hasHash('md5')); //=> true

cryptorjs.hash('ciao', 'md5');

/*=> '6e6bc4e49dd477ebc98ef4046c067b5f'*/

cryptorjs.hash('ciao', 'sha1');

/*=> '1e4e888ac66f8dd41e00c5a7ac36a32a9950d271'*/
```

### Supported ciphers (since 3.0.0)
- aes-256-cbc
- aes-256-cbc-hmac-sha1
- aes-256-cbc-hmac-sha256
- aes-256-cfb
- aes-256-cfb1
- aes-256-cfb8
- aes-256-ctr
- aes-256-ofb
- aes256
- camellia-256-cbc
- camellia-256-cfb
- camellia-256-cfb1
- camellia-256-cfb8
- camellia-256-ofb
- camellia256

## License
Cryptorjs is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

## Author
[Fabio Ricali](http://rica.li)

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