X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fstorage.h;h=989f33142e18e63de06795d7491ff8391ff67c63;hp=62de488d808e57bb92f448d080e89de9c98c178e;hb=1e57394b3bb6aaf6213270658e00975b19f02d26;hpb=5b686746c880e5cda6d5de3e08180ea4332ff222 diff --git a/src/core/storage.h b/src/core/storage.h index 62de488d..989f3314 100644 --- a/src/core/storage.h +++ b/src/core/storage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2015 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -42,6 +42,16 @@ public: NotAvailable // remove the storage backend from the list of avaliable backends }; + enum HashVersion { + sha1, +#if QT_VERSION >= 0x050000 + sha2_512, + latest=sha2_512 +#else + latest=sha1 +#endif + }; + public slots: /* General */ @@ -408,10 +418,17 @@ signals: void userRemoved(UserId); protected: - //! when implementing a storage handler, use this method to crypt user passwords. - /** This guarantees compatibility with other storage handlers and allows easy migration - */ - QString cryptedPassword(const QString &password); + QString hashPassword(const QString &password); + bool checkHashedPassword(const UserId user, const QString &password, const QString &hashedPassword, const Storage::HashVersion version); + +private: + QString hashPasswordSha1(const QString &password); + bool checkHashedPasswordSha1(const QString &password, const QString &hashedPassword); + +#if QT_VERSION >= 0x050000 + QString hashPasswordSha2_512(const QString &password); + bool checkHashedPasswordSha2_512(const QString &password, const QString &hashedPassword); +#endif };