Why is it wrong to judge whether the sha1 encrypted string after the POST is equal.

Source: Internet
Author: User
Tags form post unpack
Why is it wrong to judge whether the sha1 encrypted string after the POST is equal. For example, the encrypted string 356a192b7913b04c54574d18c28d46e6395428ab is returned in the form post.
Then, if ($ _ POST ['s '] = '356a192b7913b04c54574d18c28d46e6395428ab ')
Why is it false?
Echo $ _ POST ['s'] is also 356a192b7913b04c54574d18c28d46e6395428ab ..


Reply to discussion (solution)

Check whether $ _ POST ['s '] is the value.

Check whether $ _ POST ['s '] is correct... I tried it at BAE .. Why...

You might as well use var_dump () to see if it contains a space line break or something.

You might as well use var_dump () to see if it contains a space line break or something.
No .. And I also used trim () to filter out .. Can you help me check it out. Http://hole.icnu.me/t1.php

I copied his var_dump () output quotation marks + value can be true.
If you open a quotation mark by yourself, it is false... Why ??

You may not have posted your code.

You may not have posted your code.
T. php code ..

 ';var_dump($_POST['set']);if($_POST['set']=="f45918a75f152c9ce0b58043d5e5d7f22358665c")echo 'qw';?>

That is, the double quotation mark in if is used as false by hand .. I don't know why...
Http://hole.icnu.me/t1.php here post to t. php

You may not have posted your code.
It should be encoding problems. The conversion encoding is acceptable ..


You may not have posted your code.
It should be encoding problems. The conversion encoding is acceptable ..

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

I want to re-describe it...
The sha1 encrypted characters should be 40 characters
After post, how can it become 43 characters ...?
It is also 40 characters to re-encrypt on the following page ..
However, if you directly specify a pointer to the encrypted string, it will be 43 characters long...
Why?

Data from var_dump () post
String (43 )"? 356a192b7913b04c54574d18c28d46e6395428ab"
Var_dump (sha1 ('1 '))
String (40) "356a192b7913b04c54574d18c28d46e6395428ab"
Var_dump ('356a192b7913b04c54574d18c28d46e6395428ab ')
String (43 )"? 356a192b7913b04c54574d18c28d46e6395428ab"

Your echo pack ('H * ', $ _ POST ['set']); check the result.

Your echo pack ('H * ', $ _ POST ['set']); check the result.

Sorry, I made a mistake!
In this way:
Print_r (unpack ('H * ', $ _ POST ['set']);

Sorry, I made a mistake!
In this way:
Print_r (unpack ('H * ', $ _ POST ['set']);

Array ([1] => struct)

Array ([1] => struct)

This efbbbf is the UTF-8 BOM header.
You can remove the BOM header of the relevant file.

Array ([1] => struct)

This efbbbf is the UTF-8 BOM header.
You can remove the BOM header of the relevant file.

Thank you ~~

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.