22absl::StatusOr<std::string>
HashPassword(std::string_view password) {
26 std::array<char, crypto_pwhash_STRBYTES> hash{};
28 if (crypto_pwhash_str(hash.data(), password.data(), password.size(),
29 crypto_pwhash_OPSLIMIT_INTERACTIVE,
30 crypto_pwhash_MEMLIMIT_INTERACTIVE) != 0) {
31 return absl::ResourceExhaustedError(
"ran out of memory hashing a password");
33 return std::string(hash.data());