Why does the post come over the SHA1 cipher string equal to the wrong judgment?

Source: Internet
Author: User
Tags form post sha1 unpack
For example, my form post came up SHA1 (' 1 ') this encrypted string 356a192b7913b04c54574d18c28d46e6395428ab.
Then I if ($_post[' s ']== ' 356a192b7913b04c54574d18c28d46e6395428ab ')
Why is it judged false?
echo $_post[' s '] is also 356a192b7913b04c54574d18c28d46e6395428ab.


Reply to discussion (solution)

Double-check $_post[' s ' is not that value

Check the $_post[' s '. Is that the value I have on the right ah ... I was on Bae's test. Never understood why ...

Why don't you use Var_dump () to see if it contains a space wrap or something?

Why don't you use Var_dump () to see if it contains a space wrap or something?
No, it's not. And I also use trim () to filter the said. Can you help me to see it. http://hole.icnu.me/t1.php

I copy his var_dump () output quote + value can be true.
The quotation marks in my hand are false ... Why is that??

Put out your code, maybe not the reason you said

Put out your code, maybe not the reason you said
t.php Code:

 
  '; Var_dump ($_post[' set ']); if ($_post[' Set ']== "f45918a75f152c9ce0b58043d5e5d7f22358665c") echo ' QW ';? >

That is, if the double-struck trumpeter is false. I don't know why ...
http://hole.icnu.me/t1.php here post to t.php

Put out your code, maybe not the reason you said
It should be a coding problem. The conversion code can be:


Put out your code, maybe not the reason you said
It should be a coding problem. The conversion code can be:

Wrong wrong ... I don't know why ...

I want to re-describe it ...
SHA1 encrypted characters should be 40
How did it become 43 characters after the post came in?
In the back of the page re-encryption is also 40 characters of:
However, if you specify the pointer directly, the encrypted string is also 43 characters ...
Why?

Var_dump () Post data
String ("? 356a192b7913b04c54574d18c28d46e6395428ab")
Var_dump (SHA1 (' 1 '))
String ("356a192b7913b04c54574d18c28d46e6395428ab")
Var_dump (' 356a192b7913b04c54574d18c28d46e6395428ab ')
String ("? 356a192b7913b04c54574d18c28d46e6395428ab")

You echo pack (' h* ', $_post[' set '); Look at the results.

You echo pack (' h* ', $_post[' set '); Look at the results.

Sorry, I made a mistake!
Such
Print_r (Unpack (' h* ', $_post[' Set '));

Sorry, I made a mistake!
Such
Print_r (Unpack (' h* ', $_post[' Set '));

Array ([1] = efbbbf33353661313932623739313362303463353435373464313863323864343665363339353432386162)

Array ([1] = efbbbf33353661313932623739313362303463353435373464313863323864343665363339353432386162)

This EFBBBF is Utf-8 's BOM head.
You get rid of the BOM header of the relevant file.

Array ([1] = efbbbf33353661313932623739313362303463353435373464313863323864343665363339353432386162)

This EFBBBF is Utf-8 's BOM head.
You get rid of the BOM header of the relevant file.

Thanks.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.