# unixpass

> Native implementation of Unix compatible DES/MD5/SHA256/SHA512 password hashing.

Latest version **4.0.0** (published 2026-11-21) · GPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install unixpass
pnpm add unixpass
yarn add unixpass
bun add unixpass
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

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

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2026-11-21 |
| First published | 2016-05-21 |
| Weekly downloads | 0 |
| License | GPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.0.0 |
| Dependencies | 1 |
| Unpacked size | 51.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Timo J. Rinne |
| Maintainers | rinne |
| Keywords | unix, linux, password, security, MD5, SHA256, SHA512, DES |

## Links

- npm: https://www.npmjs.com/package/unixpass
- Repository: https://github.com/rinne/node-unixpass
- Homepage: https://github.com/rinne/node-unixpass#readme
- Issues: https://github.com/rinne/node-unixpass/issues
- npm.io page: https://npm.io/package/unixpass

## Dependencies (1)

- [blowfish-js](https://npm.io/package/blowfish-js.md) ^1.0.0

## Alternatives

- [adhdev](https://npm.io/package/adhdev.md) — 11.1K weekly downloads
- [react-slide-button](https://npm.io/package/react-slide-button.md) — 310 weekly downloads
- [better](https://npm.io/package/better.md) — 42 weekly downloads
- [react-native-swipe-image](https://npm.io/package/react-native-swipe-image.md) — 22 weekly downloads
- [nl.fokkezb.pulltorefresh](https://npm.io/package/nl.fokkezb.pulltorefresh.md) — 11 weekly downloads

## Recent versions

- 4.0.0 (latest) — 2026-11-21
- 3.0.1 — 2022-01-25
- 3.0.0 — 2022-01-25
- 2.1.1 — 2022-01-17
- 2.1.0 — 2022-01-17
- 2.0.0 — 2022-01-17
- 1.0.3 — 2018-08-09
- 1.0.2 — 2018-08-09
- 1.0.1 — 2016-05-21
- 1.0.0 — 2016-05-21

## README

In A Nutshell
=============

This is a native javascript implementation of Unix/Linux compatible
password hashing. The currently implemented variants include
legacy-DES (13 characters [./0-9A-Za-z]), extended-DES (underscore
followed by 19 characters) MD5 ($1$), SHA256 ($5$), SHA512 ($6$), and
BCrypt ($2a$).


Usage
=====

```
const up = require('unixpass');

// Returns password hash using SHA256
up.crypt('mypassword', '$5$saltsaltmoresalt');

// Returns a password hash with autogenerated salt using SHA512
up.mkpass('mypassword');

// Returns true if password matches hash, false otherwise
up.check('mypassword', '$1$saltsalt$dfhjlwheucnsdicbnwuibnwicb');

```

Caution!
========

Be aware that legacy-DES only cares about first 8 characters of the
password. While no new passwords should be encrypted using that, it
may be useful in validating some old stuff. Also, it is an interesting
piece of history that deserves to be reimplemented also in js.


BCrypt
======

I don't like BCrypt and didn't even think that I'd ever implement it,
but eventually did it anyways. The code does not implement any
backward compatibilities for earlied bugs. Instead, it blindly accepts
any currently known variant specifier, but performs the actual hashing
identically. The maximum meaningful length of the UTF-8 encoded
password in BCrypt is 72 bytes. Longer passwords are truncated.


Author
======

Timo J. Rinne <tri@iki.fi>


License
=======

GPL-2.0

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