summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-27 19:06:47 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-27 19:06:47 (GMT)
commitaa09a889108c4d0e3c5888ad98958d8f3e12bd3b (patch)
tree3c621ae0a6e2150281be182b37e2837b804adcba /Swiften/Avatars
parentc89ef0ffae597ac8c1063732e1d9a2d84703a80c (diff)
downloadswift-contrib-aa09a889108c4d0e3c5888ad98958d8f3e12bd3b.zip
swift-contrib-aa09a889108c4d0e3c5888ad98958d8f3e12bd3b.tar.bz2
Added MD5 hashing algorithm.
Moved 'hexifying' of hashes into its own class, such that it can be shared between all hashes.
Diffstat (limited to 'Swiften/Avatars')
-rw-r--r--Swiften/Avatars/AvatarManager.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Swiften/Avatars/AvatarManager.cpp b/Swiften/Avatars/AvatarManager.cpp
index 574e199..599d1d4 100644
--- a/Swiften/Avatars/AvatarManager.cpp
+++ b/Swiften/Avatars/AvatarManager.cpp
@@ -6,6 +6,7 @@
#include "Swiften/Elements/VCardUpdate.h"
#include "Swiften/Queries/Requests/GetVCardRequest.h"
#include "Swiften/StringCodecs/SHA1.h"
+#include "Swiften/StringCodecs/Hexify.h"
#include "Swiften/Avatars/AvatarStorage.h"
#include "Swiften/MUC/MUCRegistry.h"
@@ -41,7 +42,7 @@ void AvatarManager::handleVCardReceived(const JID& from, const String& promisedH
std::cerr << "Warning: " << from << ": Could not get vCard" << std::endl;
return;
}
- String realHash = SHA1::getHexHash(vCard->getPhoto());
+ String realHash = Hexify::hexify(SHA1::getHash(vCard->getPhoto()));
if (promisedHash != realHash) {
std::cerr << "Warning: " << from << ": Got different vCard photo hash (" << promisedHash << " != " << realHash << ")" << std::endl;
}
@@ -50,7 +51,7 @@ void AvatarManager::handleVCardReceived(const JID& from, const String& promisedH
}
void AvatarManager::setAvatar(const JID& jid, const ByteArray& avatar) {
- String hash = SHA1::getHexHash(avatar);
+ String hash = Hexify::hexify(SHA1::getHash(avatar));
avatarStorage_->addAvatar(hash, avatar);
setAvatarHash(getAvatarJID(jid), hash);
}