Home > Net >  Website Sign some special symbols cause encryption algorithm
Website Sign some special symbols cause encryption algorithm

Time:09-24

A sign algorithm principle is simple

The code below



Public string GetSig (string request, string body)
{
The string result=request + body;
Result=web. UrlDecode (result, Encoding UTF8);
UrlHelper url=new UrlHelper (result);
Result=url. Sort ();
The debug. WriteLine (result);
Result=result. Replace (" & amp;" , "");
The debug. WriteLine (result);
Result=Encoding. UTF8. GetBytes (result). The Md5 () ToHex () ToLower ();
return result;
}

When the body parameter contains the URL address server error prompt signature

For example: referer=http://https://bbs.csdn.net/topics/new? Forum_id=CSharp& Id=1

After debugging is parameter contains the inside & amp; Character segmentation error in

Consult everybody a great god how should handle

CodePudding user response:

You this parameter is CSharp& forum_id value; Id=1, rather than a forum_id with id?

CodePudding user response:

The
big watermelon a WuYiJin reference 1 floor? Response:
you forum_id this parameter value is CSharp& Id=1, rather than a forum_id with id?


You understand the wrong I mean, I'm mean original url like http://www.xxx.com/api/r/emotion/package/list? App=1.1 & amp; The client=android& referer=http://https://bbs.csdn.net/topics/new? Forum_id=CSharp& Id=1

When the referer parameter contains the inside & amp; Sign signature calculation errors, I put & amp; Symbols to replace % 26 or

CodePudding user response:

Don't know you is what kind of language, the signature of the parameters are generally to the original keys and add key md5, you get your own parameters for urldecode

CodePudding user response:

The
big watermelon a WuYiJin reference 3 floor? Response:
don't know you is what kind of language, the signature of the parameters in general are the keys to the original keys and md5, on whether you get your own parameters urldecode

Language=& gt; Combination of

CodePudding user response:

Then you can encode,

CodePudding user response:

But I'm more strange is,
Result=the result in your approach. The Replace (" & amp;" , "");
The & amp; Replaced the,
That before you submit, also need the same rule to set the sign, this should be no problem!
  •  Tags:  
  • C#
  • Related