#pragma once #include class ChallengeResponse { public: const unsigned long NONCE_LIFETIME_MS = 3000; ChallengeResponse(const std::string &pw); bool verify(const std::string &hash); /*! * Initiate a new challenge-response round. * * Updates the internal state and returns the nonce to be sent to the client. * The challenge must be answered within NONCE_LIFETIME_MS milliseconds. * * \returns The nonce. */ uint32_t nonce(void); private: std::string m_passwd; uint32_t m_currentNonce; unsigned long m_expireTime; };