|
3 | 3 | 
|
4 | 4 | 
|
5 | 5 |
|
6 |
| -🚀 Fastest bcrypt in NodeJS |
| 6 | +🚀 Fastest bcrypt in Node.js |
7 | 7 |
|
8 | 8 | ## Support matrix
|
9 | 9 |
|
10 | 10 | | | node10 | node12 | node14 | node15 |
|
11 | 11 | | --------------- | ------ | ------ | ------ | ------ |
|
12 | 12 | | Windows x64 | ✓ | ✓ | ✓ | ✓ |
|
13 | 13 | | Windows x32 | ✓ | ✓ | ✓ | ✓ |
|
14 |
| -| macOS x64/arm64 | ✓ | ✓ | ✓ | ✓ | |
| 14 | +| macOS x64 | ✓ | ✓ | ✓ | ✓ | |
| 15 | +| macOS arm64 | ✓ | ✓ | ✓ | ✓ | |
15 | 16 | | Linux x64 gnu | ✓ | ✓ | ✓ | ✓ |
|
16 | 17 | | Linux x64 musl | ✓ | ✓ | ✓ | ✓ |
|
17 | 18 | | Linux arm gnu | ✓ | ✓ | ✓ | ✓ |
|
|
21 | 22 | ## Usage
|
22 | 23 |
|
23 | 24 | ```typescript
|
24 |
| -export const DEFAULT_ROUND = 12 |
| 25 | +export const DEFAULT_COST: 12 |
25 | 26 |
|
26 |
| -function hashSync(password: string | Buffer, round?: number): string |
27 |
| -function hash(password: string | Buffer, round?: number): Promise<string> |
28 |
| -function verifySync(password: string | Buffer, hash: string | Buffer): boolean |
29 |
| -function verify(password: string | Buffer, hash: string | Buffer): Promise<boolean> |
| 27 | +export function hashSync(password: string | Buffer, round?: number): string |
| 28 | +export function hash(password: string | Buffer, round?: number): Promise<string> |
| 29 | +export function verifySync(password: string | Buffer, hash: string | Buffer): boolean |
| 30 | +export function verify(password: string | Buffer, hash: string | Buffer): Promise<boolean> |
| 31 | +/** |
| 32 | + * The same with `verifySync` |
| 33 | + */ |
| 34 | +export function compareSync(password: string | Buffer, hash: string | Buffer): boolean |
| 35 | +/** |
| 36 | + * The same with `verify` |
| 37 | + */ |
| 38 | +export function compare(password: string | Buffer, hash: string | Buffer): Promise<boolean> |
| 39 | + |
| 40 | +export type Version = '2a' | '2x' | '2y' | '2b' |
| 41 | +/** |
| 42 | + * @param round default 10 |
| 43 | + * @param version default '2b' |
| 44 | + */ |
| 45 | +export function genSaltSync(round?: number, version?: Version): string |
| 46 | +/** |
| 47 | + * @param round default 10 |
| 48 | + * @param version default '2b' |
| 49 | + */ |
| 50 | +export function genSalt(round?: number, version?: Version): Promise<string> |
30 | 51 | ```
|
31 | 52 |
|
32 | 53 | ## Bench
|
|
0 commit comments