(crypto: ISodium)
| 137 | } |
| 138 | |
| 139 | export async function hash(crypto: ISodium) { |
| 140 | await crypto.initialize(); |
| 141 | const saltBytes = crypto.crypto_generichash( |
| 142 | crypto.crypto_pwhash_SALTBYTES, |
| 143 | "mysalt" |
| 144 | ); |
| 145 | return crypto.crypto_pwhash( |
| 146 | 32, |
| 147 | "mypassword", |
| 148 | saltBytes, |
| 149 | 3, // operations limit |
| 150 | 1024 * 1024 * 64, // memory limit (8MB) |
| 151 | crypto.crypto_pwhash_ALG_ARGON2ID13, |
| 152 | "base64" |
| 153 | ); |
| 154 | } |
no test coverage detected