diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-04-23 09:17:52 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-04-23 09:17:52 +0000 |
commit | 6f2bd00100522615ff8a5dda1166a4b3312879d0 (patch) | |
tree | 35ed24bf2fcfe3340fba9b5b218a59cf3a8b6674 /src/net/accountserver | |
parent | ee6cd05382e4933bac8a6d6c007f112ac37a9f36 (diff) | |
download | mana-client-6f2bd00100522615ff8a5dda1166a4b3312879d0.tar.gz mana-client-6f2bd00100522615ff8a5dda1166a4b3312879d0.tar.bz2 mana-client-6f2bd00100522615ff8a5dda1166a4b3312879d0.tar.xz mana-client-6f2bd00100522615ff8a5dda1166a4b3312879d0.zip |
Replaced SHA-256 implementation with the one from InspIRCd. Thanks to Bertram
for initial modifications.
Diffstat (limited to 'src/net/accountserver')
-rw-r--r-- | src/net/accountserver/account.cpp | 14 | ||||
-rw-r--r-- | src/net/accountserver/accountserver.cpp | 7 |
2 files changed, 9 insertions, 12 deletions
diff --git a/src/net/accountserver/account.cpp b/src/net/accountserver/account.cpp index bb0214d3..2d8065b5 100644 --- a/src/net/accountserver/account.cpp +++ b/src/net/accountserver/account.cpp @@ -24,7 +24,6 @@ #include "account.h" #include <string> -#include "../../utils/encryption.h" #include "internal.h" @@ -32,6 +31,8 @@ #include "../messageout.h" #include "../protocol.h" +#include "../../utils/sha256.h" + void Net::AccountServer::Account::createCharacter( const std::string &name, char hairStyle, char hairColor, char gender, short strength, short agility, short vitality, @@ -77,14 +78,13 @@ void Net::AccountServer::Account::unregister(const std::string &username, MessageOut msg(PAMSG_UNREGISTER); msg.writeString(username); - msg.writeString(Encryption::GetSHA2Hash( - std::string (username + password))); + msg.writeString(sha256(username + password)); Net::AccountServer::connection->send(msg); } void Net::AccountServer::Account::changeEmail(const std::string &username, - const std::string &email) + const std::string &email) { MessageOut msg(PAMSG_EMAIL_CHANGE); @@ -103,10 +103,8 @@ void Net::AccountServer::Account::changePassword( MessageOut msg(PAMSG_PASSWORD_CHANGE); // Change password using SHA2 encryption - msg.writeString(Encryption::GetSHA2Hash( - std::string (username + oldPassword))); - msg.writeString(Encryption::GetSHA2Hash( - std::string (username + newPassword))); + msg.writeString(sha256(username + oldPassword)); + msg.writeString(sha256(username + newPassword)); Net::AccountServer::connection->send(msg); } diff --git a/src/net/accountserver/accountserver.cpp b/src/net/accountserver/accountserver.cpp index a641ab47..db94563b 100644 --- a/src/net/accountserver/accountserver.cpp +++ b/src/net/accountserver/accountserver.cpp @@ -24,7 +24,6 @@ #include "accountserver.h" #include <string> -#include "../../utils/encryption.h" #include "internal.h" @@ -32,6 +31,8 @@ #include "../messageout.h" #include "../protocol.h" +#include "../../utils/sha256.h" + void Net::AccountServer::login(Net::Connection *connection, int version, const std::string &username, const std::string &password) { @@ -41,9 +42,7 @@ void Net::AccountServer::login(Net::Connection *connection, int version, msg.writeInt32(version); msg.writeString(username); - // The password is hashed - msg.writeString(Encryption::GetSHA2Hash( - std::string (username + password))); + msg.writeString(sha256(username + password)); Net::AccountServer::connection->send(msg); } |