# uuid-by-string

> Generating uuid-hash from string

Latest version **4.0.0** (published 2022-09-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install uuid-by-string
pnpm add uuid-by-string
yarn add uuid-by-string
bun add uuid-by-string
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2022-09-05 |
| First published | 2016-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 10.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 66 |
| Author | Danakt Saushkin |
| Maintainers | danakt |
| Keywords | uuid, guid, rfc4122, rfc-4122, hash, v3, v5, md5, sha-1 |

## Links

- npm: https://www.npmjs.com/package/uuid-by-string
- Repository: https://github.com/Danakt/uuid-by-string
- Issues: https://github.com/Danakt/uuid-by-string/issues
- npm.io page: https://npm.io/package/uuid-by-string

## Dependencies (2)

- [js-md5](https://npm.io/package/js-md5.md) ^0.7.3
- [js-sha1](https://npm.io/package/js-sha1.md) ^0.6.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2022-09-05
- 3.0.7 — 2022-04-26
- 3.0.6 — 2022-02-03
- 3.0.5 — 2021-12-25
- 3.0.4 — 2021-05-27
- 3.0.3 — 2021-05-27
- 3.0.2 — 2019-11-05
- 3.0.1 — 2019-10-30
- 3.0.0 — 2019-10-30
- 2.1.5 — 2019-07-14
- 2.1.4 — 2019-07-08
- 2.1.3 — 2019-07-05
- 2.1.1 — 2019-04-02
- 2.1.0 — 2019-02-10
- 2.0.1 — 2018-11-10
- … 14 more at https://npm.io/package/uuid-by-string/versions

## README

uuid-by-string
[![NPM](https://img.shields.io/npm/v/uuid-by-string.svg?style=flat-square&maxAge=3600)](https://www.npmjs.com/package/uuid-by-string)
[![Downloads](https://img.shields.io/npm/dw/uuid-by-string.svg?style=flat-square&maxAge=3600)](https://www.npmjs.com/package/uuid-by-string)
[![Build Status](https://img.shields.io/travis/danakt/uuid-by-string.svg?style=flat-square&maxAge=3600)](https://travis-ci.org/danakt/uuid-by-string)
=======================
Generates the [RFC-4122](https://tools.ietf.org/html/rfc4122#section-4.3) Name-Based UUID. Supports 3 and 5 versions of UUID.

## Installation

```bash
# via NPM
npm install uuid-by-string

# or Yarn
yarn add uuid-by-string
```

## Usage

The package has only one default exported method. Method receives any string and returns generated hash

```js
const getUuid = require('uuid-by-string');

const uuidHash = getUuid('Hello world!');
// d3486ae9-136e-5856-bc42-212385ea7970
```

The string `Hello world!` will always returns `d3486ae9-136e-5856-bc42-212385ea7970`.

You can specify the UUID version. Available versions is 3 and 5 according to [RFC-4122](https://tools.ietf.org/html/rfc4122#section-4.3). The version is responsible for the hashing algorithm: version 3 uses MD5, and version 5 uses SHA-1. SHA-1 used by default if version is not specified.

```js
const uuidV3Hash = getUuid('Hello world!', 3);
// 86fb269d-190d-3c85-b6e0-468ceca42a20

const uuidV5Hash = getUuid('Hello world!', 5);
// d3486ae9-136e-5856-bc42-212385ea7970
```

## API

`getUuid(name [, version]);`

`getUuid(name [, namespace, version]);`

- `name` — hashing target
- `namespace` _Optional_ — UUID namespace
- `version` _Optional_ — 3 or 5, version of UUID

## License

[MIT licensed](LICENSE)

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