Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/behnammodi/object-hash-light

Generate hashes from objects and values in modern browser
https://github.com/behnammodi/object-hash-light

Last synced: about 1 month ago
JSON representation

Generate hashes from objects and values in modern browser

Awesome Lists containing this project

README

        

# object-hash-light

Generate hashes from objects and values in modern browser, node and deno

| Node | Deno | Chrome | Firefox | Opera | Safari |
| ---- | ---- | ------ | ------- | ----- | ------ |
| 15 | 1.11 | 37 | 34 | 24 | 7 |

\* Android Chrome, Firefox and iOS Safari support version is same with Desktop version

Less than < 300 Bytes [bundlephobia](https://bundlephobia.com/package/object-hash-light)

# install

```bash
npm i object-hash-light
```

# usage

```js
import hash from "object-hash-light";

const result = await hash({ foo: "bar" });
// result is a5e744d0164540d33b1d7ea616c28f2fa97e754a
```

# algorithms

SHA-1 (default), SHA-256, SHA-384, SHA-512

```js
const result = await hash({ foo: "bar" }, { algorithm: "SHA-512" });
// result is 0db68ad4e41d3b26ba3fc48a5da7c9f616b813e77cb4e951187e1f2a37c2bad94041089f89f6012ee7b44e21f863c5d9553e3b665edae8640bb2274b555266eb
```