You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| random | *function(number):!Array.<number>* | Function taking the number of bytes to generate as its sole argument, returning the corresponding array of cryptographically secure random byte values.
123
+
| **@see** | | http://nodejs.org/api/crypto.html
124
+
| **@see** | | http://www.w3.org/TR/WebCryptoAPI/
128
125
126
+
### genSaltSync(rounds=, seed_length=)
129
127
130
-
### bcrypt.genSaltSync(rounds=, seed_length=)
131
128
Synchronously generates a salt.
132
129
133
-
| Name | Type | Description |
134
-
| ---- | ---- | ----------- |
135
-
| rounds | number | Number of rounds to use, defaults to 10 if omitted |
Asynchronously generates a hash for the given string.
161
160
162
-
| Name | Type | Description |
163
-
| ---- | ---- | ----------- |
164
-
| s | string | String to hash |
165
-
| salt | number ¦ string | Salt length to generate or salt to use |
166
-
| callback | function(Error, ?string) | Callback receiving the error, if any, and the resulting hash |
167
-
| progressCallback | function(number) | Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
| salt | *number | string* | Salt length to generate or salt to use
165
+
| callback | *function(Error, string=)* | Callback receiving the error, if any, and the resulting hash
166
+
| progressCallback | *function(number)* | Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
167
+
168
+
### compareSync(s, hash)
168
169
169
-
### bcrypt.compareSync(s, hash)
170
170
Synchronously tests a string against a hash.
171
171
172
-
| Name | Type | Description |
173
-
| ---- | ---- | ----------- |
174
-
| s | string | String to compare |
175
-
| hash | string | Hash to test against |
176
-
||||
177
-
| **returns** | boolean | true if matching, otherwise false
Asynchronously compares the given data against the given hash.
182
182
183
-
| Name | Type | Description |
184
-
| ---- | ---- | ----------- |
185
-
| s | string | Data to compare |
186
-
| hash | string | Data to be compared to |
187
-
| callback | function(Error, boolean) | Callback receiving the error, if any, otherwise the result |
188
-
| progressCallback | function(number) | Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
189
-
||||
190
-
| **throws** | Error | If the callback argument is invalid
| callback | *function(Error, boolean)* | Callback receiving the error, if any, otherwise the result
188
+
| progressCallback | *function(number)* | Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
189
+
| **@throws** | *Error* | If the callback argument is invalid
190
+
191
+
### getRounds(hash)
191
192
192
-
### bcrypt.getRounds(hash)
193
193
Gets the number of rounds used to encrypt the specified hash.
194
194
195
-
|Name | Type | Description |
196
-
|----|----|-----------|
197
-
| hash |string| Hash to extract the used number of rounds from |
198
-
||||
199
-
| **returns**| number | Number of rounds used
200
-
| **throws** | Error | If hash is not a string
201
-
202
-
### bcrypt.getSalt(hash)
203
-
Gets the salt portion from a hash.
204
-
205
-
|Name | Type | Description |
206
-
|----|----|-----------|
207
-
| hash |string| Hash to extract the salt from |
208
-
||||
209
-
| **returns**| string | Extracted salt part portion
210
-
| **throws** | Error | If `hash` is not a string or otherwise invalid
0 commit comments