sha512-crypt-ts
Version:
Typescript wrapper for SHA-512, including $6$ crypt format.
30 lines (26 loc) • 1.78 kB
Markdown
[](http://makeapullrequest.com)


[](https://codecov.io/gh/bedlaj/sha512-crypt-ts)
[](https://lgtm.com/projects/g/bedlaj/sha512-crypt-ts/alerts/)
[](https://lgtm.com/projects/g/bedlaj/sha512-crypt-ts/context:javascript)
# SHA-512-crypt-ts
Crypt compatible typescript implementation inspired by [mvo5/sha512crypt-node](https://github.com/mvo5/sha512crypt-node)
# Installation
#### Install [NPM package](https://www.npmjs.com/package/sha512-crypt-ts)
```
npm install --save sha512-crypt-ts
```
#### Import module
```
import { sha512 } from 'sha512-crypt-ts';
```
#### Usage
```
sha512.crypt('password', 'saltsalt');
// This is equivalent to: printf "password" | mkpasswd --stdin --method=sha-512 --salt=saltsalt
// Returns $6$saltsalt$qFmFH.bQmmtXzyBY0s9v7Oicd2z4XSIecDzlB5KiA2/jctKu9YterLp8wwnSq.qc.eoxqOmSuNp2xS0ktL3nh/
```
Another examples can be found in [unit tests](https://github.com/bedlaj/sha512-crypt-ts/blob/master/tests/sha512.test.ts) or in peer project [bedlaj/unifi-reset-password](https://github.com/bedlaj/unifi-reset-password/blob/master/src/app/app.component.ts).
#### Documentation
Generated docs can be found at https://bedlaj.github.io/sha512-crypt-ts/modules/sha512.html