🛠️

Whiz Tools

Build • Create • Innovate

CURP Generator Tool for Testing and Validation Purposes

Generate valid, random CURPs (Clave Única de Registro de Población) for testing purposes. This tool creates CURPs that comply with official Mexican format and validation rules, without using real personal information.

Generate CURP

📚

Documentation

CURP Generator

Introduction

The CURP (Clave Única de Registro de Población) is a unique alphanumeric code used in Mexico for identification purposes. This tool generates valid, random CURPs for testing scenarios, complying with the official format and validation rules. It's important to note that these generated CURPs are not tied to real individuals and should only be used for testing purposes.

Structure of CURP

A CURP consists of 18 characters in the following format:

  1. First letter of the paternal last name
  2. First vowel of the paternal last name (excluding the first letter)
  3. First letter of the maternal last name
  4. First letter of the given name 5-10. Date of birth (YYMMDD format)
  5. Gender (H for male, M for female) 12-13. Two-letter code for the state of birth 14-16. First internal consonant of each name component (paternal surname, maternal surname, given name)
  6. Differentiation digit (0-9 for people born before 2000, A-Z for those born from 2000 onward)
  7. Check digit (0-9)

Algorithm for Generating a Random CURP

  1. Generate random letters for name components
  2. Generate a random date of birth
  3. Randomly select gender
  4. Randomly select a valid state code
  5. Generate random consonants for internal name components
  6. Determine the differentiation digit based on the birth year
  7. Calculate the check digit
  8. Combine all components to form the CURP

Validation Rules

  • All alphabetic characters must be uppercase
  • The date of birth must be a valid date (including leap year consideration)
  • The state code must be a valid Mexican state code
  • The differentiation digit must correspond to the birth year
  • The check digit must be correctly calculated
  • Handle special cases for names (e.g., single-letter surnames, names with Ñ)

Use Cases

  1. Software Testing: Developers can use this tool to generate valid CURPs for testing user registration systems, database operations, or any software that requires CURP input.

  2. Data Privacy: When demonstrating software or presenting data, using randomly generated CURPs helps protect individuals' privacy.

  3. Performance Testing: Generate large sets of unique CURPs to test system performance under load.

  4. Training and Education: Use generated CURPs in educational materials about Mexican identification systems without using real personal data.

History of CURP in Mexico

The CURP system was introduced in 1996 by the Mexican government as part of an effort to modernize and standardize personal identification. It replaced various other identification systems and became a crucial element in Mexican bureaucracy, used for everything from school enrollment to tax filing.

Over the years, the CURP system has undergone several modifications:

  • In 2011, the differentiation digit was introduced to distinguish between people born before and after 2000.
  • In 2012, the algorithm for calculating the check digit was modified to improve uniqueness.

Examples

Here are code examples to generate random CURPs in various programming languages:

1import random
2import string
3from datetime import datetime, timedelta
4
5def generate_curp():
6    # Generate name components
7    paternal = random.choice(string.ascii_uppercase) + random.choice('AEIOU')
8    maternal = random.choice(string.ascii_uppercase)
9    given = random.choice(string.ascii_uppercase)
10
11    # Generate date of birth
12    start_date = datetime(1940, 1, 1)
13    end_date = datetime.now()
14    random_date = start_date + timedelta(days=random.randint(0, (end_date - start_date).days))
15    date_str = random_date.strftime("%y%m%d")
16
17    # Generate gender
18    gender = random.choice(['H', 'M'])
19
20    # Generate state code
21    states = ['AS', 'BC', 'BS', 'CC', 'CL', 'CM', 'CS', 'CH', 'DF', 'DG', 'GT', 'GR', 'HG', 'JC', 'MC', 'MN', 'MS', 'NT', 'NL', 'OC', 'PL', 'QT', 'QR', 'SP', 'SL', 'SR', 'TC', 'TS', 'TL', 'VZ', 'YN', 'ZS']
22    state = random.choice(states)
23
24    # Generate consonants
25    consonants = ''.join(random.choices(string.ascii_uppercase.translate(str.maketrans('', '', 'AEIOU')), k=3))
26
27    # Generate differentiation digit
28    diff_digit = random.choice(string.digits) if int(date_str[:2]) < 20 else random.choice(string.ascii_uppercase)
29
30    # Generate check digit (simplified for this example)
31    check_digit = random.choice(string.digits)
32
33    return f"{paternal}{maternal}{given}{date_str}{gender}{state}{consonants}{diff_digit}{check_digit}"
34
35## Generate and print a random CURP
36print(generate_curp())
37

Alternatives in Other Countries

While the CURP is unique to Mexico, other countries have similar identification systems:

  1. United States: Social Security Number (SSN)
  2. Canada: Social Insurance Number (SIN)
  3. India: Aadhaar Number
  4. Brazil: Cadastro de Pessoas Físicas (CPF)

Each system has its own structure and rules, but they serve similar purposes in their respective countries.

References

  1. SEGOB (Secretaría de Gobernación). "CURP - Trámites." Gobierno de México, https://www.gob.mx/curp/. Accessed 4 Aug. 2024.
  2. RENAPO (Registro Nacional de Población e Identidad). "Instructivo Normativo para la Asignación de la Clave Única de Registro de Población." Gobierno de México, https://www.gob.mx/cms/uploads/attachment/file/79053/InstructivoNormativoCURP.pdf. Accessed 4 Aug. 2024.