git-svn-id: svn://db.shs.com.ru/pip@625 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2018-09-12 08:44:44 +00:00
parent 9b994d1ffd
commit d534225a8c
3 changed files with 34 additions and 18 deletions

View File

@@ -151,7 +151,20 @@ PIByteArray PICrypt::hash(const PIString & secret) {
#else
PICRYPT_DISABLED_WARNING
#endif
return hash;
return hash;
}
PIByteArray PICrypt::hash(const PIByteArray & data) {
PIByteArray hash;
#ifdef PIP_CRYPT
if (!init()) return hash;
hash.resize(crypto_generichash_BYTES);
crypto_generichash(hash.data(), hash.size(), data.data(), data.size(), (const uchar*)hash_def_key, sizeof(hash_def_key) - 1);
#else
PICRYPT_DISABLED_WARNING
#endif
return hash;
}