# crypto-ts

> Typescript library of crypto standards.

Latest version **1.0.2** (published 2018-05-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install crypto-ts
pnpm add crypto-ts
yarn add crypto-ts
bun add crypto-ts
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-05-05 |
| First published | 2018-05-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 879.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 52 |
| Maintainers | hmoog |
| Keywords | angular, javascript, typescript |

## Links

- npm: https://www.npmjs.com/package/crypto-ts
- Repository: https://github.com/hmoog/crypto-ts
- Issues: https://github.com/hmoog/crypto-ts/issues
- npm.io page: https://npm.io/package/crypto-ts

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.7.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-05-05
- 1.0.1 — 2018-05-05

## README

# crypto-ts

Typescript library of crypto standards. Ready for AOT and treeshaking in combination with Angular and other modern typescript frameworks.

## Node.js (Install)

Requirements:

- Node.js
- npm (Node.js package manager)

```bash
npm install crypto-ts
```

### Usage

ES6 import for typical API call signing use case:

```javascript
import { AES } from 'crypto-ts';

const encryptedMessage = AES.encrypt('message', 'test').toString();
```

Modular include:

```javascript
var AES = require("crypto-ts").AES;
var SHA256 = require("crypto-ts").SHA256;
...
console.log(SHA256("Message"));
```

Including all libraries, for access to extra methods:

```javascript
var CryptoTS = require("crypto-ts");
...
console.log(CryptoTS.HmacSHA1("Message", "Key"));
```

## Client (browser)

Requirements:

- Node.js
- Bower (package manager for frontend)

```bash
bower install crypto-ts
```

### Usage

Modular include:

```javascript
require.config({
    packages: [
        {
            name: 'crypto-ts',
            location: 'path-to/bower_components/crypto-ts',
            main: 'index'
        }
    ]
});

require(["crypto-ts/algo/aes", "crypto-ts/algo/sha256"], function (AES, SHA256) {
    console.log(SHA256("Message"));
});
```

Including all libraries, for access to extra methods:

```javascript
// Above-mentioned will work or use this simple form
require.config({
    paths: {
        'crypto-ts': 'path-to/bower_components/crypto-ts/crypto-ts'
    }
});

require(["crypto-ts"], function (CryptoTS) {
    console.log(CryptoTS.MD5("Message"));
});
```

### Usage without RequireJS

```html
<script type="text/javascript" src="path-to/bower_components/crypto-ts/crypto-ts.js"></script>
<script type="text/javascript">
    var encrypted = CryptoTS.AES(...);
    var encrypted = CryptoTS.SHA256(...);
</script>
```

### AES Encryption

#### Plain text encryption

```javascript
var CryptoTS = require("crypto-ts");

// Encrypt
var ciphertext = CryptoTS.AES.encrypt('my message', 'secret key 123');

// Decrypt
var bytes  = CryptoTS.AES.decrypt(ciphertext.toString(), 'secret key 123');
var plaintext = bytes.toString(CryptoTS.enc.Utf8);

console.log(plaintext);
```

#### Object encryption

```javascript
var CryptoTS = require("crypto-ts");

var data = [{id: 1}, {id: 2}]

// Encrypt
var ciphertext = CryptoTS.AES.encrypt(JSON.stringify(data), 'secret key 123');

// Decrypt
var bytes  = CryptoTS.AES.decrypt(ciphertext.toString(), 'secret key 123');
var decryptedData = JSON.parse(bytes.toString(CryptoTS.enc.Utf8));

console.log(decryptedData);
```

### List of modules


- ```crypto-ts/core```
- ```crypto-ts/x64-core```
- ```crypto-ts/lib-typedarrays```

---

- ```crypto-ts/md5```
- ```crypto-ts/sha1```
- ```crypto-ts/sha256```
- ```crypto-ts/sha224```
- ```crypto-ts/sha512```
- ```crypto-ts/sha384```
- ```crypto-ts/sha3```
- ```crypto-ts/ripemd160```

---

- ```crypto-ts/hmac-md5```
- ```crypto-ts/hmac-sha1```
- ```crypto-ts/hmac-sha256```
- ```crypto-ts/hmac-sha224```
- ```crypto-ts/hmac-sha512```
- ```crypto-ts/hmac-sha384```
- ```crypto-ts/hmac-sha3```
- ```crypto-ts/hmac-ripemd160```

---

- ```crypto-ts/pbkdf2```

---

- ```crypto-ts/aes```
- ```crypto-ts/tripledes```
- ```crypto-ts/rc4```
- ```crypto-ts/rabbit```
- ```crypto-ts/rabbit-legacy```
- ```crypto-ts/evpkdf```

---

- ```crypto-ts/format-openssl```
- ```crypto-ts/format-hex```

---

- ```crypto-ts/enc-latin1```
- ```crypto-ts/enc-utf8```
- ```crypto-ts/enc-hex```
- ```crypto-ts/enc-utf16```
- ```crypto-ts/enc-base64```

---

- ```crypto-ts/mode-cfb```
- ```crypto-ts/mode-ctr```
- ```crypto-ts/mode-ctr-gladman```
- ```crypto-ts/mode-ofb```
- ```crypto-ts/mode-ecb```

---

- ```crypto-ts/pad-pkcs7```
- ```crypto-ts/pad-ansix923```
- ```crypto-ts/pad-iso10126```
- ```crypto-ts/pad-iso97971```
- ```crypto-ts/pad-zeropadding```
- ```crypto-ts/pad-nopadding```

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