static inline token hash(token const& pw, token const& salt) { token result; if(::libscrypt_scrypt( pw.data(), pw.size(), salt.data(), salt.size(), SCRYPT_N, SCRYPT_r, SCRYPT_p, result.data(), result.size() ) == -1) throw std::runtime_error("Incapable of hashing token"); return result; }
static inline token hash(const std::string &pw, token const& salt) { token result; if(::libscrypt_scrypt( (const uint8_t*)pw.data(), pw.size(), salt.data(), salt.size(), SCRYPT_N, SCRYPT_r, SCRYPT_p, result.data(), result.size() ) == -1) throw std::runtime_error("Incapable of hashing plaintext"); return result; }
/* * Returns the number of children tokens at current token */ unsigned int get_size(void) { return cur->size(); }