I’m having trouble understanding the difference between
A) return strcmp($digest, $signature) == 0;
and
B) return strcmp($digest, $signature);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Normally
strcmp()returns -1, 0, or 1 if the first string is less than, equal to, or greater than the second respectively. By comparing the result of that to 0 inthe result of
strcmp()is turned to a boolean that only tests for equality rather than greater than/less than by comparison. The function will returnTRUEif the two strings are equal (strcmp() == 0), andFALSEotherwise, discarding the other greater/less than information.