We Built a Python Library That Generates UIDs in Indian Scripts (And It's Already Live in Our App)

Author: Indilingo Team | Date: March 11, 2026

We Built a Python Library That Generates UIDs in Indian Scripts (And It's Already Live in Our App)

Here's something that bothered us for a long time.

Every time you receive an OTP on your phone, every referral code you share with a friend, every short URL you click on: the characters are always the same. Latin. English. 'A-Z', '0-9'. That's it.

We're building Indilingo, an app dedicated to celebrating and teaching Indian languages. We have users who speak Hindi, Gujarati, Tamil, Telugu, Kannada, Bengali, and more. And yet, when we sat down to build our referral feature, we realized we were about to hand every single one of those users a referral code in... English.

That felt wrong. So we decided to fix it.

The Problem No One Was Talking About

India has over a billion people. Hundreds of millions of them interact with digital products every single day: logging in, getting OTPs, sharing codes with friends, clicking short links. And in all of that, there is not a single mainstream tool or library that generates unique identifiers in Indian scripts.

Not one.

Every UUID library, every OTP generator, every short-code tool assumes Latin characters. It's not malicious. It's just a gap nobody thought to fill. India's developer community builds world-class software, but the foundational tooling for something as simple as an identifier has never reflected India's linguistic reality.

We thought: if not us, then who?

English vs Indic Referral Code Comparison

How It Started: A Referral Feature, a Realization, and a Decision

When we started working on Indilingo's referral program, the plan was simple: give every user a unique referral code, let them share it with friends, reward them when friends join. Standard stuff.

But then we asked ourselves: what should this code look like?

Our app exists to make people proud of Indian languages, to show that these scripts are rich, beautiful, and absolutely worthy of the modern digital world. How could we launch a referral feature and hand our Hindi-speaking users a code like 'kXp9Ra'? It would be a contradiction at the heart of everything we're building.

So instead of going with the default, we went looking for an existing solution. We searched PyPI, GitHub, everywhere. Nothing. There was genuinely no Python library that could generate random, unique identifiers using Indian language scripts.

So we built one ourselves. And then we open sourced it, because a tool like this belongs to the entire community, not just to us.

Introducing ‘indic-uid’

Indic UID Python Library Code Example

indic-uid is a lightweight, zero-dependency Python library for generating unique identifiers using Indian language scripts. It currently supports 7 scripts:

  • Devanagari (Hindi, Marathi, Sanskrit): अ, क, ख, ग, घ
  • Gujarati: અ, ક, ખ, ગ, ઘ
  • Kannada: ಅ, ಕ, ಖ, ಗ, ಘ
  • Tamil: அ, க, ங, ச, ஞ
  • Telugu: అ, క, ఖ, గ, ఘ
  • Bengali: অ, ক, খ, গ, ঘ
  • English: for when you need a mix

That's a character pool of ~240 characters, giving you collision probabilities so low they're practically theoretical. With just 6-character IDs, you can safely generate over 13 million unique IDs before the odds of a collision hit even 1 in a million.

Get Started in 30 Seconds

Install it from PyPI with a single pip command:

pip install indic-uid

PyPI page: https://pypi.org/project/indic-uid/

That's it. No dependencies. No configuration files. Just install and go.

Basic Usage


from indic_uid import generate_id

# Generate a random 6-character ID (uses all scripts by default)
id = generate_id()
print(id)  # Example: 'कஆಗઘతঅ'

# Generate from a specific script
hindi_id = generate_id(scripts=['devanagari'])
print(hindi_id)  # Example: 'घअकआइश'

# Generate a pronounceable ID (alternates vowels and consonants)
pronounceable_id = generate_id(pronounceable=True, scripts=['devanagari'])
print(pronounceable_id)  # Example: 'कअखइगउ'

# Generate in bulk
from indic_uid import generate_batch
ids = generate_batch(count=100, length=6, scripts=['gujarati'])
  

Referral Codes (exactly how we use it)


from indic_uid import generate_id

def create_referral_code(user_id: int) -> str:
    code = generate_id(length=6, scripts=['devanagari'])
    return code
  

Validation and Script Detection


from indic_uid import is_valid_id, get_script_of_char

# Validate an ID
print(is_valid_id('कखगघचछ'))                               # True
print(is_valid_id('kXp9Ra'))                                 # False

# Validate against a specific script
print(is_valid_id('கஅசஇடஉ', scripts=['tamil']))         # True
print(is_valid_id('கஅசஇடஉ', scripts=['devanagari']))    # False

# Detect which script a character belongs to
print(get_script_of_char('क'))                              # 'devanagari'
print(get_script_of_char('க'))                              # 'tamil'
  

Collision Probability Analysis


from indic_uid import calculate_collision_probability, estimate_safe_id_count

# How safe is your setup?
prob = calculate_collision_probability(
    num_ids=1_000_000,
    length=6,
    num_scripts=6
)
print(f"Collision probability: {prob:.2e}")
# Output: Collision probability: 5.45e-06 (1 in 183,000 -- extremely safe)

# How many IDs can you safely generate?
safe_count = estimate_safe_id_count(length=6, num_scripts=6, max_collision_prob=0.000001)
print(f"Safe ID count: {safe_count:,}")
# Output: Safe ID count: 13,856,406
  

It's Already Live. This Isn't Just Theory.

We didn't just build this and throw it on GitHub. We shipped it.

Every user who signs up on Indilingo today gets a unique referral code generated in Indian scripts. Refer five friends who join the app, and you unlock a 40% discount. And that discount code? Also generated using indic-uid. Indic script, all the way through.

This is a real production feature, handling real users, right now. The library is stable, cryptographically secure (it uses Python's built-in secrets module under the hood), and has been tested against real-world usage patterns.

We wanted to show that this wasn't just a cool idea. We wanted to prove it works. We think we have.

Indilingo Referral Code Screenshot

Why This Matters Beyond Indilingo

We want to be honest about something: we didn't build indic-uid just for ourselves.

The problem we ran into is not specific to Indilingo. Any Indian startup, whether it's a fintech sending OTPs, an e-commerce platform creating coupon codes, a logistics company issuing tracking IDs, or a health-tech app generating patient tokens, could use this.

Right now, almost none of them do. Not because they don't want to, but because the tooling didn't exist.

That's what we're trying to change by open sourcing this. If a fintech in Mumbai decides to send OTPs in Devanagari, we want to make that decision easy. If an e-commerce platform in Chennai wants discount codes in Tamil, we want that to be a one-line change. The infrastructure should exist. Now it does.

On Indian Languages in the Digital World

There's a broader conversation worth having here.

Indian scripts are some of the oldest and most sophisticated writing systems in the world. Devanagari has been around for over a thousand years. Tamil's literary tradition goes back even further. These aren't ancient relics. They're living, breathing languages used by hundreds of millions of people every single day.

And yet, in the digital world, they're consistently treated as second-class. Fonts are an afterthought. Rendering is inconsistent. And the basic building blocks of software, random IDs, tokens, codes, are entirely Latin-centric by default.

We're not going to fix all of that overnight. But we can make it a little easier for the next developer who asks the same question we asked: why does this have to be in English?

What's Next

indic-uid is version 0.1.0 right now. Here's what we're thinking about for the road ahead:

  • Support for more scripts (Punjabi/Gurmukhi, Odia, Malayalam)
  • A JavaScript / TypeScript version
  • A REST API wrapper
  • More pronounceable ID patterns

Try It, Star It, Build With It

pip install indic-uid

PyPI: https://pypi.org/project/indic-uid/

GitHub: https://github.com/aayush-mor13/indic-uid

Indilingo App: Download and try the referral feature yourself

If you find this useful, star the repo. If you build something with it, we genuinely want to know.

Made with love, for the Indian developer community.

indic-uid is MIT licensed and free to use in any project, commercial or otherwise. Contributions are welcome.

Loved the Blog?

Take your language learning journey a step further.

Explore Indilingo - beautifully designed, easy to use, and built for Indian languages.
Get it on Google Play pointer-events-noneDownload on App Store pointer-events-none