def getSHA1(self, token, timestamp, nonce, encrypt):
try:<EOL><INDENT>sortlist = [token, timestamp, nonce, encrypt]<EOL>sortlist.sort()<EOL>sha = hashlib.sha1()<EOL>sha.update("<STR_LIT>".join(sortlist))<EOL>return WXBizMsgCrypt_OK, sha.hexdigest()<EOL><DEDENT>except Exception:<EOL><INDENT>return WXBizMsgCrypt_ComputeSignature_Error, None<EOL><DEDENT>
用SHA1算法生成安全签名
        @param token:  票据
        @param timestamp: 时间戳
        @param encrypt: 密文
        @param nonce: 随机字符串
        @return: 安全签名