npm package: @pingleware/crypto-js
Description: Merging CryptoJS with noble-post-quantum.
Author: PressPage Entertainment Inc DBA PINGLEWARE
Latest version: 1.0.0

# @pingleware/crypto-js

JavaScript library of crypto standards.

## Revitalization

While the original CrpytoJS project development been discontinued and is no longer maintained.

PRESSPAGE ENTERTAINMENT INC dba PINGLEWARE has forked and merging the noble-post-quantum project, fixing as needed.

## Node.js (Install)

Requirements:

- Node.js
- npm (Node.js package manager)

```bash
npm install @pingleware/crypto-js
```

### Usage

ES6 import for typical API call signing use case:

```javascript
import sha256 from '@pingleware/crypto-js/sha256';
import hmacSHA512 from '@pingleware/crypto-js/hmac-sha512';
import Base64 from '@pingleware/crypto-js/enc-base64';

const message, nonce, path, privateKey; // ...
const hashDigest = sha256(nonce + message);
const hmacDigest = Base64.stringify(hmacSHA512(path + hashDigest, privateKey));
```

Modular include:

```javascript
var AES = require("@pingleware/crypto-js/aes");
var SHA256 = require("@pingleware/crypto-js/sha256");
...
console.log(SHA256("Message"));
```

Including all libraries, for access to extra methods:

```javascript
var CryptoJS = require("@pingleware/crypto-js");
console.log(CryptoJS.HmacSHA1("Message", "Key"));
```

## Client (browser)

Requirements:

- Node.js
- Bower (package manager for frontend)

```bash
bower install @pingleware/crypto-js
```

### Usage

Modular include:

```javascript
require.config({
    packages: [
        {
            name: '@pingleware/crypto-js',
            location: 'path-to/bower_components/crypto-js',
            main: 'index'
        }
    ]
});

require(["@pingleware/crypto-js/aes", "crypto-js/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: {
        '@pingleware/crypto-js': 'path-to/bower_components/crypto-js/crypto-js'
    }
});

require(["@pingleware/crypto-js"], function (CryptoJS) {
    console.log(CryptoJS.HmacSHA1("Message", "Key"));
});
```

### Usage without RequireJS

```html
<script type="text/javascript" src="path-to/bower_components/crypto-js/crypto-js.js"></script>
<script type="text/javascript">
    var encrypted = CryptoJS.AES(...);
    var encrypted = CryptoJS.SHA256(...);
</script>
```

## API

See: https://cryptojs.gitbook.io/docs/

### AES Encryption

#### Plain text encryption

```javascript
var CryptoJS = require("@pingleware/crypto-js");

// Encrypt
var ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123').toString();

// Decrypt
var bytes  = CryptoJS.AES.decrypt(ciphertext, 'secret key 123');
var originalText = bytes.toString(CryptoJS.enc.Utf8);

console.log(originalText); // 'my message'
```

#### Object encryption

```javascript
var CryptoJS = require("@pingleware/crypto-js");

var data = [{id: 1}, {id: 2}]

// Encrypt
var ciphertext = CryptoJS.AES.encrypt(JSON.stringify(data), 'secret key 123').toString();

// Decrypt
var bytes  = CryptoJS.AES.decrypt(ciphertext, 'secret key 123');
var decryptedData = JSON.parse(bytes.toString(CryptoJS.enc.Utf8));

console.log(decryptedData); // [{id: 1}, {id: 2}]
```

### List of modules


- ```@pingleware/crypto-js/core```
- ```@pingleware/crypto-js/x64-core```
- ```@pingleware/crypto-js/lib-typedarrays```

---

- ```@pingleware/crypto-js/md5```
- ```@pingleware/crypto-js/sha1```
- ```@pingleware/crypto-js/sha256```
- ```@pingleware/crypto-js/sha224```
- ```@pingleware/crypto-js/sha512```
- ```@pingleware/crypto-js/sha384```
- ```@pingleware/crypto-js/sha3```
- ```@pingleware/crypto-js/ripemd160```

---

- ```@pingleware/crypto-js/hmac-md5```
- ```@pingleware/crypto-js/hmac-sha1```
- ```@pingleware/crypto-js/hmac-sha256```
- ```@pingleware/crypto-js/hmac-sha224```
- ```@pingleware/crypto-js/hmac-sha512```
- ```@pingleware/crypto-js/hmac-sha384```
- ```@pingleware/crypto-js/hmac-sha3```
- ```@pingleware/crypto-js/hmac-ripemd160```

---

- ```@pingleware/crypto-js/pbkdf2```

---

- ```@pingleware/crypto-js/aes```
- ```@pingleware/crypto-js/tripledes```
- ```@pingleware/crypto-js/rc4```
- ```@pingleware/crypto-js/rabbit```
- ```@pingleware/crypto-js/rabbit-legacy```
- ```@pingleware/crypto-js/evpkdf```

---

- ```@pingleware/crypto-js/format-openssl```
- ```@pingleware/crypto-js/format-hex```

---

- ```@pingleware/crypto-js/enc-latin1```
- ```@pingleware/crypto-js/enc-utf8```
- ```@pingleware/crypto-js/enc-hex```
- ```@pingleware/crypto-js/enc-utf16```
- ```@pingleware/crypto-js/enc-base64```

---

- ```@pingleware/crypto-js/mode-cfb```
- ```@pingleware/crypto-js/mode-ctr```
- ```@pingleware/crypto-js/mode-ctr-gladman```
- ```@pingleware/crypto-js/mode-ofb```
- ```@pingleware/crypto-js/mode-ecb```

---

- ```@pingleware/crypto-js/pad-pkcs7```
- ```@pingleware/crypto-js/pad-ansix923```
- ```@pingleware/crypto-js/pad-iso10126```
- ```@pingleware/crypto-js/pad-iso97971```
- ```@pingleware/crypto-js/pad-zeropadding```
- ```@pingleware/crypto-js/pad-nopadding```


## Release notes

### 1.0.0

Build the crypto-js under @pingleware/crypto-js, to prepare merging noble-post-quantum