Using the safeEquals method to prevent timing attacks