# framed-hash

> A hash function that wraps all input chunks with a length prefix.

Latest version **1.1.0** (published 2015-06-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install framed-hash
pnpm add framed-hash
yarn add framed-hash
bun add framed-hash
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2015-06-12 |
| First published | 2015-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/framed-hash
- Repository: https://github.com/mafintosh/framed-hash
- Issues: https://github.com/mafintosh/framed-hash/issues
- npm.io page: https://npm.io/package/framed-hash

## Recent versions

- 1.1.0 (latest) — 2015-06-12
- 1.0.1 — 2015-06-06
- 1.0.0 — 2015-06-06

## README

# framed-hash

A hash function that wraps all input chunks with a length prefix.

```
npm install framed-hash
```

[![build status](http://img.shields.io/travis/mafintosh/framed-hash.svg?style=flat)](http://travis-ci.org/mafintosh/framed-hash)

## Usage

``` js
var framedHash = require('framed-hash')

var hash = framedHash('sha256')

hash.update('hello')
hash.update('world')

// prints 9054cf26016be468a8b56b40342bd5b479202a40da9fc9056b1ac4c5070343d8
console.log(hash.digest('hex'))

var anotherHash = framedHash('sha256')

anotherHash.update('hell')
anotherHash.update('oworld')

// prints 9cb231ff970f99993c9753364405184fc9024c3f56d98716d90f4913a6c746c0
// since the input chunks were different
console.log(anotherHash.digest('hex'))
```

## API

#### `hash = framedHash(algorithm)`

Create a new hash instance. Algorithm can be anything accepted by `crypto.createHash(algo)`

#### `hash.update(chunk)`

Update the hash. Internally the chunk is prefixed with the length of the chunk and a newline

#### `hash.digest(encoding)`

Returns the digest of the hash.

## License

MIT

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