Joke Collection Website - Blessing messages - About the sig field of Tencent Cloud SMS interface, sha256 encryption problem, nodejs.
About the sig field of Tencent Cloud SMS interface, sha256 encryption problem, nodejs.
const? Password? =? Request ("crypto");
Function? Signature ()
{
var? strMobile? =? "This is my mobile phone"; ? //The contents of the mobile field of //tel.
var? strAppKey? =? "This is my key"; ? //appkey corresponding to //sdkappid needs to be kept highly confidential by business parties.
var? strRand? =? "7226249334"; ? //The value of the random field in the //url.
var? strTime? =? " 1457336869"; ? //unix timestamp
var? buf? =? " appkey = "+strAppKey+" & amp; random = "+strRand+" & amp; Time = "
+strTime+" & amp; mobile = "+strMobile;
var? sig? =? crypto.createHash('sha256 ')。 Update (buf,? utf-8’)。 digest(' hex ');
Return? sig
}
console . log(SIG()); The output results are as follows:
7b1e97051886ad66c684530db2b01644f828f31E06D624d88af5469afaa0 The reason is that utf-8 is emphasized in the document, but the default encoding of js is not this, so it needs to be specified.
In addition, the calculation result of this sig is related to your output parameters, not a constant.
There is also how your mobile phone and appkey are delivered in Chinese, and the official ones seem to be numbers and letters.
- Previous article:How to write a short message to my husband San Xiao?
- Next article:Hegang mobile SMS opens GPRS monthly package. Send what?
- Related articles
- How wechat binds the mailbox wechat binds the mailbox.
- Huawei mate40pro randomly pops up advertising links
- I can't get the postal message at first, so remind me to change my mobile phone number, ok?
- What does installment credit mean?
- Excuse me, what happened when I received a text message to supplement my registration information on my mobile phone?
- Can I go to another 4S shop for maintenance?
- Which package is best for China Mobile?
- Which service is good for SMS?
- How to spend Christmas?
- Latest news from Shenyang Public Security Bureau