hash and verify passwords with bcrypt
curl -sX POST 'https://api.whittly.dev/v1/bcrypt/hash' \
-H 'Authorization: Bearer $WHITTLY_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"password":"hunter2","cost":10}'
const res = await fetch('https://api.whittly.dev/v1/bcrypt/hash', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + apiKey,
'Content-Type': 'application/json',
},
body: JSON.stringify({ password: "hunter2", cost: 10 }),
});
const data = await res.json();
const { data } = await axios.post(
'https://api.whittly.dev/v1/bcrypt/hash',
{ password: "hunter2", cost: 10 },
{ headers: { Authorization: 'Bearer ' + apiKey } }
);
Bcrypt is an adaptive password hashing algorithm designed to remain slow as hardware improves. The cost factor (work factor) determines how many rounds of hashing are performed — doubling the cost factor doubles the computation time. This makes brute-force attacks progressively harder as hardware gets faster.