Added secure compare to mitigate timing attacks