base setup

This commit is contained in:
2026-01-07 12:09:20 +05:30
commit 0c275efea1
278 changed files with 11228 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import hashlib
from hashids import Hashids
from django.conf import settings
def hexdigest(text):
text_hash = hashlib.sha256(text.encode()).hexdigest()
return text_hash
HASHIDS = Hashids(salt=settings.SECRET_KEY, min_length=12) # or 8
def encode_id(pk):
return HASHIDS.encode(pk)
def decode_slug(slug):
return HASHIDS.decode(slug)[0] if HASHIDS.decode(slug) else None