X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fstorage.h;h=989f33142e18e63de06795d7491ff8391ff67c63;hp=9984d3177bcc51d0c48ec0fc3a0fa9de3970a283;hb=1e57394b3bb6aaf6213270658e00975b19f02d26;hpb=921e54680da16fcf2adb7a90506875aceb6633a4 diff --git a/src/core/storage.h b/src/core/storage.h index 9984d317..989f3314 100644 --- a/src/core/storage.h +++ b/src/core/storage.h @@ -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 };