x64 fixICU fixes

git-svn-id: svn://db.shs.com.ru/pip@100 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2015-04-15 07:52:07 +00:00
parent 04481dd908
commit eb99c5752e
4 changed files with 9 additions and 87 deletions

View File

@@ -21,6 +21,7 @@
#ifdef PIP_CRYPT
# include "sodium.h"
#endif
const char hash_def_key[] = "_picrypt_";
PICrypt::PICrypt() {
@@ -36,9 +37,9 @@ PICrypt::PICrypt() {
}
bool PICrypt::setKey(const PIByteArray & secret) {
if (secret.size() != key_.size()) return false;
key_ = secret;
bool PICrypt::setKey(const PIByteArray & _key) {
if (_key.size() != key_.size()) return false;
key_ = _key;
return true;
}
@@ -48,7 +49,7 @@ PIByteArray PICrypt::setKey(const PIString & secret) {
#ifdef PIP_CRYPT
hash.resize(crypto_generichash_BYTES);
PIByteArray s(secret.data(), secret.size());
crypto_generichash(hash.data(), hash.size(), s.data(), s.size(), 0, 0);
crypto_generichash(hash.data(), hash.size(), s.data(), s.size(), (const uchar*)hash_def_key, sizeof(hash_def_key) - 1);
hash.resize(key_.size());
setKey(hash);
#endif
@@ -137,7 +138,7 @@ PIByteArray PICrypt::hash(const PIString & secret) {
sodium_init();
hash.resize(crypto_generichash_BYTES);
PIByteArray s(secret.data(), secret.size());
crypto_generichash(hash.data(), hash.size(), s.data(), s.size(), 0, 0);
crypto_generichash(hash.data(), hash.size(), s.data(), s.size(), (const uchar*)hash_def_key, sizeof(hash_def_key) - 1);
#endif
return hash;
}