# shasum-object

> get the shasum of a buffer or object

Latest version **1.0.1** (published 2025-09-11) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install shasum-object
pnpm add shasum-object
yarn add shasum-object
bun add shasum-object
```

Provides the command `shasum-object`.

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

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

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2025-09-11 |
| First published | 2019-10-29 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Renée Kooi |
| Maintainers | goto-bus-stop |
| Keywords | buffer, hash, object, sha1, shasum |

## Links

- npm: https://www.npmjs.com/package/shasum-object
- Repository: https://github.com/goto-bus-stop/shasum-object
- Issues: https://github.com/goto-bus-stop/shasum-object/issues
- npm.io page: https://npm.io/package/shasum-object

## Dependencies (1)

- [fast-safe-stringify](https://npm.io/package/fast-safe-stringify.md) ^2.0.7

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2025-09-11
- 1.0.0 — 2019-10-29

## README

# shasum-object

Get the shasum of a buffer or object.

[Description](#description) - [Install](#install) - [Usage](#usage) - [License: Apache-2.0](#license)

[![npm][npm-image]][npm-url]
[![actions][actions-image]][actions-url]
[![standard][standard-image]][standard-url]

[npm-image]: https://img.shields.io/npm/v/shasum-object.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/shasum-object
[actions-image]: https://img.shields.io/github/actions/workflow/status/goto-bus-stop/shasum-object/ci.yml
[actions-url]: https://github.com/goto-bus-stop/shasum-object/actions/workflows/ci.yml
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/standard

## Description

shasum-object computes a hash string for strings, buffers, and JSON objects.

Sha1 is used by default, but other algorithms provided by Node.js are supported.

shasum-object is committed to supporting all Node.js versions 0.8 and up.

This is a spiritual successor to [shasum](https://github.com/dominictarr/shasum).

## Install

```
npm install shasum-object
```

## Usage

```js
var fs = require('fs')
var shasum = require('shasum-object')

shasum('of a string')
shasum(fs.readFileSync('of-a-file.txt'))

shasum({
  of: ['an', 'object']
})
```

## API
### `shasum(input, algorithm = 'sha1', encoding = 'hex')`

Compute the hash for the given input.
- `input` - a string, buffer or JSON object. objects are stringified using [`fast-safe-stringify`](https://github.com/davidmarkclements/fast-safe-stringify).
- `algorithm` - the hash algorithm to use. see [`crypto.createHash`](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options).
- `encoding` - how to encode the hash result. see [`hash.digest`](https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding).

## License

[Apache-2.0](LICENSE.md)

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