diff options
author | Remko Tronçon <git@el-tramo.be> | 2013-04-26 20:07:58 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2013-04-27 11:02:06 (GMT) |
commit | 5d8c328e236f57d7390d32f9ea7bd17a31e1e740 (patch) | |
tree | bebe606707a6b835fe3fd15e694d629b5e420947 /Swiften/StringCodecs/PBKDF2.h | |
parent | aa131405927fc7f597ed06aff71abb0a30b59926 (diff) | |
download | swift-contrib-5d8c328e236f57d7390d32f9ea7bd17a31e1e740.zip swift-contrib-5d8c328e236f57d7390d32f9ea7bd17a31e1e740.tar.bz2 |
Removing third-party hash implementations.
Using library/platform implementation instead.
Change-Id: I2457c2dad80e6fdda023a7f31c3906ff10fe09ed
Diffstat (limited to 'Swiften/StringCodecs/PBKDF2.h')
-rw-r--r-- | Swiften/StringCodecs/PBKDF2.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Swiften/StringCodecs/PBKDF2.h b/Swiften/StringCodecs/PBKDF2.h index 0c04145..ae0bb17 100644 --- a/Swiften/StringCodecs/PBKDF2.h +++ b/Swiften/StringCodecs/PBKDF2.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2013 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -8,18 +8,17 @@ #include <Swiften/Base/SafeByteArray.h> #include <Swiften/Base/Concat.h> +#include <Swiften/Crypto/CryptoProvider.h> namespace Swift { class PBKDF2 { public: - template<typename PRF> - static ByteArray encode(const SafeByteArray& password, const ByteArray& salt, int iterations) { - PRF prf; - ByteArray u = prf(password, concat(salt, createByteArray("\0\0\0\1", 4))); + static ByteArray encode(const SafeByteArray& password, const ByteArray& salt, int iterations, CryptoProvider* crypto) { + ByteArray u = crypto->getHMACSHA1(password, concat(salt, createByteArray("\0\0\0\1", 4))); ByteArray result(u); int i = 1; while (i < iterations) { - u = prf(password, u); + u = crypto->getHMACSHA1(password, u); for (unsigned int j = 0; j < u.size(); ++j) { result[j] ^= u[j]; } |