Home > Back-end >  C # code DELPHI
C # code DELPHI

Time:12-09

//joining together into a string, in parameter list order equipment secret key to put the last
Public static void demo ()
{
String parameters=code + money + deviceid + loginuserid + timespan.
String token=GetToken (parameters);
}
# region token generated
Public static string GetToken (string parameters)
{
String devicekey="";
Using (var provider=System. Security. Cryptography. SHA1CryptoServiceProvider. The Create ())
{
//ASCII code
Byte [] ASCIIBytes=System. Text. Encoding. The ASCII. GetBytes (the parameters + devicekey);
Byte [] hashBytes=provider.Com puteHash (ASCIIBytes);
//to lowercase, remove the '-'
Return a string. Join (string. The Empty, hashBytes. Select (c=& gt; C.T oString (" x2 ")). ToArray ());
//another written
//return BitConverter. ToString (hashBytes) Replace (" - ", ""). ToLower ();
}
}
# endregion
Which master can convert GetToken function to DELPHI code,
  • Related