5.0.4 • Published 9 months ago

@esm-pack/bcrypt v5.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@esm-pack/bcrypt

build from bcrypt-ts esm version.

Usage - Sync

To hash a password:

import { genSaltSync, hashSync } from "@esm-pack/bcrypt";

const salt = genSaltSync(10);
const hash = hashSync("B4c0//", salt);
// Store hash in your password DB.

To check a password:

import { compareSync } from "@esm-pack/bcrypt";

// Load hash from your password DB.
compareSync("B4c0//", hash); // true
compareSync("not_bacon", hash); // false

Auto-gen a salt and hash at the same time:

import { hashSync } from "@esm-pack/bcrypt";

const hash = hashSync("bacon", 8);

Usage - Async

To hash a password:

import { genSalt, hash } from "@esm-pack/bcrypt";

const salt = await genSalt(10);
const hash = await hash("B4c0//", salt);
// Store hash in your password DB.

To check a password:

import { compare } from "@esm-pack/bcrypt";

// Load hash from your password DB.
const hash = "xxxxxx";

await compare("B4c0//", hash) // true
await compare("not_bacon", hash) // false

Auto-gen a salt and hash:

import { hash } from "@esm-pack/bcrypt";

const result = await hash("bacon")

more docs

License

New-BSD / MIT (see)

5.0.4

9 months ago

5.0.3

9 months ago