feat: update all alg
更新所有算法
This commit is contained in:
21
larkx/proto/ids.py
Normal file
21
larkx/proto/ids.py
Normal file
@ -0,0 +1,21 @@
|
||||
import hashlib
|
||||
import random
|
||||
import string
|
||||
import uuid
|
||||
_ALPHABET = string.digits + string.ascii_letters
|
||||
|
||||
|
||||
def generate_access_key(s: str) -> str:
|
||||
return hashlib.md5(s.encode()).hexdigest()
|
||||
|
||||
|
||||
def generate_request_id() -> str:
|
||||
return ''.join((random.choice(string.ascii_lowercase + string.digits) for _ in range(10)))
|
||||
|
||||
|
||||
def generate_long_request_id() -> str:
|
||||
return str(uuid.uuid4())
|
||||
|
||||
|
||||
def generate_request_cid() -> str:
|
||||
return ''.join((random.choice(_ALPHABET) for _ in range(10)))
|
||||
Reference in New Issue
Block a user