Research on Jingdong sign calculation

Original link: https://blog.saky.site/post/jd-sign/

sign python code

 # -*- coding:utf-8 -*- import base64 import hashlib import time import uuid from urllib.parse import quote from Crypto.Cipher import AES from fastapi import FastAPI from urllib3 import disable_warnings disable_warnings() server = FastAPI() def sub(arg1, arg2, arg3): return arg1 + arg2 + arg3 def encrypt(code): return code def func_sign( functionId, body, client="apple", clientVersion="10.3.6" ): uid = "".join(str(uuid.uuid4()).split("-")) st = str(int(time.time() * 1000)) random1, random2 = 2, 0 sv = f"{random1}{random2}" lists = [ f"functionId={functionId}", f"body={body}", f"uuid={uid}", f"client={client}", f"clientVersion={clientVersion}", f"st={st}", f"sv=1{sv}" ] ret_bytes = sub(str.encode("&".join(lists)), random1, random2) lists = [ f"body={quote(body)}", f"client={client}", f"clientVersion={clientVersion}", f"uuid={uid}", f"st={st}", f"sign={hashlib.md5(base64.b64encode(ret_bytes)).hexdigest()}", f"sv=1{sv}" ] return "&".join(lists)

Interface description of Jingdong sign calculation

POST /sign

request

request BODY

fn string

body object

sub-attribute
body.url string
body.action string

Response Response

return successfully

status code 200

HEADER


Date string

Value: Thu, 19 May 2022 00:23:19 GMT

Content-Type string

Value: application/json;charset=utf-8


parameter

code int

int64

data object

sub-attribute
data.fn string
data.sign string

msg string

error return

status code 400

HEADER


Date string

Value: Thu, 19 May 2022 00:48:02 GMT

Content-Type string

Value: application/json;charset=utf-8

parameter


code int

int64

msg string

sign string

refer to

Github: https://ift.tt/vDqGxsP

This article is reprinted from: https://blog.saky.site/post/jd-sign/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment