Traditional Culture Encyclopedia - Weather forecast - Weather forecast interface: the method of calculating key with c# in SmartWeather API.
Weather forecast interface: the method of calculating key with c# in SmartWeather API.
String GetKey (string appid, string privateKey, string areaId, string date, string type)
{
//HMAC uses SHA 1
HMAC hmac = HMACSHA 1。 create();
var publicKey = "/data/? areaid = { 0 } & amptype = { 1 } & amp; Date = {2} & ampappid = {3} ";;
Var data = system. Text.Encoding.UTF8.GetBytes (string. Format(publicKey,areaId,type,date,appid));
//key
Var key = system. text . encoding . utf8 . getbytes(private key);
hmac。 Key = key
//signing data
var signedData = hmac。 ComputeHash (data);
Return to the transformation. to base 64 string(signed data);
}
Reference: blogs.com/aptdo2008/p/3566391.html.
- Previous article:How to activate community members?
- Next article:When is the peak tourist season in Tanzania?
- Related articles
- Who can tell me the weather in Hengyang in the next few days? Does it affect the solidification of concrete? thank you
- Who knows the names of foreign traditional festivals?
- China autonomous driving enterprises usher in "bright moment"
- Methods of describing temperature and precipitation
- Poetry of different latitudes
- The best time to travel to Tibet
- How did the "mango" in the 24 solar terms get its name?
- Who can tell me which city in Zhejiang has the most tourist attractions?
- Famous sentences about summer?
- History of Boli County, Heilongjiang Province