mirror of
https://github.com/napi-rs/node-rs.git
synced 2026-10-28 19:14:34 +08:00
@node-rs/bcrypt
🚀 Fastest bcrypt in NodeJS
Support matrix
| node 10 | node12 | node14 | |
|---|---|---|---|
| Windows 64 latest | ✓ | ✓ | ✓ |
| macOS latest | ✓ | ✓ | ✓ |
| Linux | ✓ | ✓ | ✓ |
Usage
export const DEFAULT_ROUND = 12
function hashSync(password: string | Buffer, round?: number): string
function hash(password: string | Buffer, round?: number): Promise<string>
function verifySync(password: string | Buffer, hash: string | Buffer): boolean
function verify(password: string | Buffer, hash: string | Buffer): Promise<boolean>
Bench
Model Name: MacBook Pro
Model Identifier: MacBookPro15,1
Processor Name: Intel Core i7
Processor Speed: 2.6 GHz
Number of Processors: 1
Total Number of Cores: 6
L2 Cache (per Core): 256 KB
L3 Cache: 12 MB
Hyper-Threading Technology: Enabled
Memory: 16 GB
@node-rs/bcrypt x 72.11 ops/sec ±1.43% (33 runs sampled) node bcrypt x 62.75 ops/sec ±2.95% (30 runs sampled) Async hash round 10 bench suite: Fastest is @node-rs/bcrypt @node-rs/bcrypt x 18.49 ops/sec ±1.04% (12 runs sampled) node bcrypt x 16.67 ops/sec ±2.05% (11 runs sampled) Async hash round 12 bench suite: Fastest is @node-rs/bcrypt @node-rs/bcrypt x 3.99 ops/sec ±3.17% (6 runs sampled) node bcrypt x 3.13 ops/sec ±1.92% (6 runs sampled) Async hash round 14 bench suite: Fastest is @node-rs/bcrypt @node-rs/bcrypt x 14.32 ops/sec ±0.55% (10 runs sampled) node bcrypt x 13.55 ops/sec ±2.83% (10 runs sampled) Async verify bench suite: Fastest is @node-rs/bcrypt @node-rs/bcrypt x 15.98 ops/sec ±1.12% (44 runs sampled) node bcrypt x 14.55 ops/sec ±1.30% (40 runs sampled) Hash round 10 bench suite: Fastest is @node-rs/bcrypt @node-rs/bcrypt x 4.65 ops/sec ±3.60% (16 runs sampled) node bcrypt x 4.26 ops/sec ±1.90% (15 runs sampled) Hash round 12 bench suite: Fastest is @node-rs/bcrypt @node-rs/bcrypt x 1.16 ops/sec ±2.65% (7 runs sampled) node bcrypt x 1.04 ops/sec ±2.95% (7 runs sampled) Hash round 14 bench suite: Fastest is @node-rs/bcrypt