SOURCE

function genSignParams(secretKey, inObject){
    var sorter = function (inObject) {
        var sortedJson = {};
        var sortedKeys = Object.keys(inObject).sort();
        for (var i = 0; i < sortedKeys.length; i++) {
            sortedJson[sortedKeys[i]] = inObject[sortedKeys[i]]
        }
        return sortedJson;
    }
    var sortedParam = sorter(inObject);
    var needSignatureStr = "";
    for (var key in sortedParam) {
        var value = sortedParam[key];
        needSignatureStr = needSignatureStr + key + '=' + value + '&';
    }
    needSignatureStr += 'secretKey=' + secretKey;
    console.log(needSignatureStr)
    // return md5(needSignatureStr).toUpperCase();
}

genSignParams('secretKey', { nc: 1, nb: 2, na: 3 })
console 命令行工具 X clear

                    
>
console