# simplecrypt

> Simple library for encrypting/decrypting strings without the boilerplate of the crypt library.

Latest version **0.1.0** (published 2013-11-06) · MIT license · 0 weekly downloads

## Install

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

## 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.0 |
| Published | 2013-11-06 |
| First published | 2013-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | me@nategood.com |
| Maintainers | nategood |
| Keywords | encryption, decryption, crypt, cryptography, cipher, strings, passwords |

## Links

- npm: https://www.npmjs.com/package/simplecrypt
- Repository: https://github.com/ShowClix/simplecrypt
- Issues: https://github.com/ShowClix/simplecrypt/issues
- npm.io page: https://npm.io/package/simplecrypt

## 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.0 (latest) — 2013-11-06
- 0.0.2 — 2013-11-06

## README

# simplecrypt

Simplecrypt is intended to be a very basic, concise library for doing
one thing: encrypting strings.  By default, it makes a lot of assumptions
for you, like what type of encryption to use (AES 192), what to use for
the key (cryptographically strong random data), how large to make the
key (256 bytes), the encoding to use (hex dump for ciphered, UTF-8 for
deciphered).  Some of these you can change (the encryption type, and the
key), but the focus here is simplicity.

Important note: if you do not specify the key, a random one is generated.
If you plan on storing the encrypted digest somewhere, then you will need
to specify a key or retrieve the key from the simplecrypt instance.

## Installation

```
npm install simplecrypt
```

## Usage

```javascript
var simplecrypt = require("simplecrypt");

var sc = simplecrypt();

var digest = sc.encrypt("my secret");
console.log(digest); // "66cea6eb1c18b8862485cf0604fa6062"

var message = sc.decrypt(digest);
console.log(message); // "my secret"
```

## API

### simplecrypt([opts])

Instantiates a new simplecrypt object.

opts

Optionally specify options to override default settings.

 - password: (string) password for encryption. defaults to large, cryptographically strong, random password.
 - salt: (string) salt to add to the message.  defaults to a random salt.
 - method: (string) the cipher to use.  defaults to aes192.
 - encoding: (string) encoding of the message. defaults to utf8.
 - digestEncoding: (string) encoding of the encrypted message. defaults to hex.

returns instance of the simplecrypt library

### .encrypt(message)

message: (string) message to encrypt
returns (string) encrypted message as hex string

### .decrypt(digest)

digest: (string) encrypted message
returns (string) original message, unencrypted

### .password()

returns (string|Buffer) password used for encryption

### .salt()

returns (string) salt used

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