[Signature pitfall] Decmail. GetBits (), getbits

Source: Internet
Author: User

[Signature pitfall] Decmail. GetBits (), getbits

The decimal type has the GetBits () method.

You can get the int [4] value of the value, and then get the byte [16] value.

 

In c #, the byte [] obtained by 0 m and 0.00m is different (for specific reasons, Baidu)

In SQL, the column of the decimal generated by EF is forced to 2 decimal places by default.

In c #, the value is 0 m, and the value is changed to 0.00 m after it is saved to the database.

 

So the question is

If the value of decimal. GetBits () is used as the content to be signed

After saving the data to the database, the signature verification fails.

 

To solve this problem, we need to convert decimal to 2 decimal places before saving it to the database.

"+ 0.01m-0.01m" is attached to the assignment statement, for example, item. Credit = value + 0.01 m-0.01 m;

This will solve this problem ......

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.