add slow equals to prevent timing attck

According to:<https://crackstation.net/hashing-security.htm#slowequals>.
We should replace "==" by slow equals to prevent timing attack.