# @theqrl/hashchains

> hashchains utilities

Latest version **0.6.1** (published 2021-05-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @theqrl/hashchains
pnpm add @theqrl/hashchains
yarn add @theqrl/hashchains
bun add @theqrl/hashchains
```

## 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.6.1 |
| Published | 2021-05-22 |
| First published | 2021-03-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | JP Lomas |
| Maintainers | jplomas |
| Keywords | hashchains, keccak, qrl, enqlave |

## Links

- npm: https://www.npmjs.com/package/@theqrl/hashchains
- Repository: https://github.com/theqrl/hashchains
- Homepage: https://github.com/theqrl/hashchains#readme
- Issues: https://github.com/theqrl/hashchains/issues
- npm.io page: https://npm.io/package/@theqrl/hashchains

## Dependencies (2)

- [bip39](https://npm.io/package/bip39.md) ^3.0.3
- [keccak](https://npm.io/package/keccak.md) ^3.0.1

## 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.6.1 (latest) — 2021-05-22
- 0.6.0 — 2021-05-22
- 0.5.0 — 2021-03-22
- 0.4.2 — 2021-03-21
- 0.4.1 — 2021-03-21
- 0.4.0 — 2021-03-21
- 0.3.1 — 2021-03-20
- 0.3.0 — 2021-03-20
- 0.2.0 — 2021-03-14
- 0.1.4 — 2021-03-14
- 0.1.3 — 2021-03-14
- 0.1.2 — 2021-03-14
- 0.1.1 — 2021-03-14
- 0.1.0 — 2021-03-14
- 0.0.4 — 2021-03-13
- … 3 more at https://npm.io/package/@theqrl/hashchains/versions

## README

# @theqrl/hashchains

[![Coverage Status](https://coveralls.io/repos/github/theQRL/hashchains/badge.svg?branch=main)](https://coveralls.io/github/theQRL/hashchains?branch=main) [![Build Status](https://www.travis-ci.com/theQRL/hashchains.svg?branch=main)](https://www.travis-ci.com/theQRL/hashchains) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/ad5f3b6ad4124518be69351feb4a8957)](https://www.codacy.com/gh/theQRL/hashchains/dashboard?utm_source=github.com&utm_medium=referral&utm_content=theQRL/hashchains&utm_campaign=Badge_Grade)
 ![npm (scoped)](https://img.shields.io/npm/v/@theqrl/hashchains) ![NPM](https://img.shields.io/npm/l/@theqrl/hashchains)

There's a [live demo on Codepen](https://codepen.io/jplomas/live/187d9ff57e404c38a76373e39b796eb4) to show the package in use.

Browser bundle at `dist/hashchains-browser.js`

Modules in `dist` but installing the npm release and import/requiring @theqrl/hashchains should work with modern toolsets, i.e:

``` bash
npm install @theqrl/hashchains
```

``` javascript
import { HashChain, HashChains } from '@theqrl/hashchains'
```

Exposes two classes:

## 1. HashChain

``` javascript
const hc = new HashChain(hashRoot, hashFunction, length)
```

### hashRoot _(string)_

#### required

The hash of `(secret data + index)` which forms the first hash in the chain and is iteratively hashed.

### hashFunction _(string)_

#### optional, default 'keccack256'

Currently only `keccak256` is implemented.

### length

#### optional, default 64

Number of hashes to generate in the chain.

## 2. HashChains

``` javascript
const hc = new HashChains(mnemonic, numberToCreate, index, hashFunction, length)
```

### mnemomic

#### required

Secret data (eg. BIP39 mnemonic or hexstring) which is hashed along with sequential index to be the start of the hashchains.

### numberToCreate

#### optional, default 2

Number of hashchains to return

### index

#### optional, default 0

Starting index for hashchains.  Starting at index 0 and generating 10 chains then starting at index 8 and generating 5 chains will create two overlapping (i.e. identical) hashchains.

### hashFunction _(string)_

#### optional, default 'keccack256'

Currently only `keccak256` is implemented.

### length

#### optional, default 64

Number of hashes to generate per chain created.

## Also in this repository

After an `npm install`:
### Live demo

``` bash
npm run serve
```
Starts a local vue development environment serving the browser-based demo from the CodePen above.  This may be useful in adding more functionality/hash functions.

### Tests

``` bash
npm run test
```

### Dev environment

``` bash
npm run dev
```

Runs a watched for continuous development: lint code as per repository standards and ensure test cases pass.

### Build

``` bash
npm run build
```

Outputs cjs/umd/esm and browserified JS modules to `dist/` directory.

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