# hash-obj

> Get the hash of an object

Latest version **5.0.0** (published 2023-11-06) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2023-11-06 |
| First published | 2015-07-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 3 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 140 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | hash, hashing, crypto, object, plain, hex, base64, md5, sha1, sha256, sha512, sum |

## Links

- npm: https://www.npmjs.com/package/hash-obj
- Repository: https://github.com/sindresorhus/hash-obj
- Homepage: https://github.com/sindresorhus/hash-obj#readme
- Issues: https://github.com/sindresorhus/hash-obj/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/hash-obj

## Dependencies (3)

- [is-obj](https://npm.io/package/is-obj.md) ^3.0.0
- [sort-keys](https://npm.io/package/sort-keys.md) ^5.0.0
- [type-fest](https://npm.io/package/type-fest.md) ^1.0.2

## 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

- 5.0.0 (latest) — 2023-11-06
- 4.0.0 — 2021-04-16
- 3.0.0 — 2019-10-04
- 2.0.0 — 2019-05-12
- 1.0.0 — 2015-07-11

## README

# hash-obj

> Get the hash of an object

## Install

```
$ npm install hash-obj
```

## Usage

```js
import hashObject from 'hash-obj';

hashObject({'🦄': '🌈'}, {algorithm: 'sha1'});
//=> '3de3bc784035b559784fc276f47493d60555fba3'
```

## API

### hashObject(object, options?)

#### object

Type: `object`

#### options

Type: `object`

##### encoding

Type: `'hex' | 'base64' | 'buffer' | 'latin1'`\
Default: `'hex'`

Encoding of the returned hash.

##### algorithm

Type: `string`\
Default: `'sha512'`\
Values: `'md5'` `'sha1'` `'sha256'` `'sha512'` etc *([Platform dependent](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm))*

*Don't use `'md5'` or `'sha1'` for anything sensitive. [They're insecure.](http://googleonlinesecurity.blogspot.no/2014/09/gradually-sunsetting-sha-1.html)*

## Related

- [hasha](https://github.com/sindresorhus/hasha) - Hashing made simple. Get the hash of a buffer/string/stream/file.

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