I'd like to store an scrypt-hashed password in a database. What is the maximum length I can expect?
相关问题
- sCrypt implementation in JavaScript? [closed]
- Hash password in Swift application
- Bouncy Castle scrypt implementation
- Python-Scrypt doesn't install on Windows 7 64-
- “error MSB8020: The build tools for v141 (Platform
相关文章
- sCrypt implementation in JavaScript? [closed]
- Hash password in Swift application
- Bouncy Castle scrypt implementation
- Python-Scrypt doesn't install on Windows 7 64-
- 如何使用scrypt生成散列在Python中的密码和盐(How to use scrypt to g
- 什么是最佳的scrypt工作的因素?(What are optimal scrypt work fa
- “error MSB8020: The build tools for v141 (Platform
- Can I improve the security of MD5 hashed passwords
In Colin Percival's own implementation, the tarsnap scrypt header is 96 bytes. This comprises:
This is also the format used by node-scrypt. There is an explanation of the rationale behind the checksum and the HMAC hash on stackexchange.
As a base64-encoded string, this makes 128 characters.
According to https://github.com/wg/scrypt the output format is
$s0$params$salt$key
where:s0
denotes version 0 of the format, with 128-bit salt and 256-bit derived key.params
is a 32-bit hex integer containing log2(N) (16 bits), r (8 bits), and p (8 bits).salt
is the base64-encoded salt.key
is the base64-encoded derived key.According to https://stackoverflow.com/a/13378842/14731 the length of a base64-encoded string is where
n
denotes the number of bytes being encoded.Let's break this down:
( log2(16) = 4 )
, so theparams
field makes up (32-bit / 4 bits) = 8 characters.(4 * ceil(16 / 3))
= 24 characters.(4 * ceil(32 / 3))
= 44 characters.Putting that all together, we get:
4 + 2 + 8 + 24 + 44
= 82 characters.