DEV Community

Cover image for CURP library CI4
Diana Laura de la Vega Sierra
Diana Laura de la Vega Sierra

Posted on

CURP library CI4

The Clave Única de Registro de Población (translated into English as Unique Population Registry Code or else as Personal ID Code Number) (abbreviated CURP) is a unique identity code for both citizens and residents of Mexico. Each CURP code is a unique alphanumeric 18-character string intended to prevent duplicate entries.

source

Hello everyone, I have been working in a CI4 library to generate the CURP according to the official rules. In the present article, I will explain to you how to use it.
Official rules to assign CURP

Rules to assign the curp

  • The first surname's initial and first inside vowel;

  • The second surname's initial (or the letter "X" if, like some foreign nationals, the person has no second surname);

  • The first given name's initial;

  • Date of birth (2 digits for year, 2 digits for month, and 2 digits for day);

  • A one-letter gender indicator (H for male (hombre in Spanish), M for female (mujer in Spanish), or X for non-binary);

  • A two-letter code for the state where the person was born; for persons born abroad, the code NE (nacido en el extranjero) is used;

  • The first surname's first inside consonant;

  • The second surname's first inside consonant;

  • The first given name's first inside consonant; and

  • One character ranging from 0-9 for people born before 2000 or from A-Z for people born since 2000; this is generated by the National Population Registry to prevent identical entries.

  • Control digit, which checks the validity of the previous 17 digits

Top comments (0)