Current location - Quotes Website - Personality signature - The parameters to be signed are sorted from small to large according to the ascii code of the field name.
The parameters to be signed are sorted from small to large according to the ascii code of the field name.
Private? String? GetSign (map< string,? String & gt? params)? {

Map< string,? String & gt? sortMap? =? New? Tree diagram & lt string,? String & gt ();

sort map . putall(params);

//? Use k1= v1&; K2=v2 ... Mode stitching parameters

StringBuilder? A builder? =? New? StringBuilder();

For what? (figure. Entry & lt string,? String & gt? s? :? sortMap.entrySet())? {

String? k? =? s . getkey();

String? v? =? s . getvalue();

What if? (StringUtils.isBlank(v))? {//? Filter null value

Continue;

}

builder.append(k)。 Append ("="). Add (v). Add&;

}

What if? (! sortMap.isEmpty())? {

builder . delete charat(builder . length()? -? 1);

}

Return? MD 5 util . MD 5 encode(builder . tostring())。 toupper case();

} Put all the parameters into treeMap (default ascending order), then splice them circularly and encrypt them with md5.