The cn_ric function within the mock-jutsu library is an essential tool for developers and QA engineers who require realistic Chinese Resident Identity Card numbers for their applications. Generating high-quality test data is critical for ensuring that systems handling international identification are robust, compliant, and capable of handling localized data formats. By using mock-jutsu, software teams can instantly produce 18-character strings that mirror the exact structure of official Chinese IDs, facilitating seamless integration testing without the privacy risks associated with using real-world sensitive information. This function is particularly valuable for platforms building localized services for the East Asian market, where strict ID validation is a standard requirement for user registration and KYC processes.
Technically, the cn_ric generator adheres strictly to the GB 11643-1999 standard, ensuring that every piece of mock data produced is syntactically correct and passes checksum validation. The 18-digit string is composed of four distinct segments: a six-digit administrative division code representing the individual's registered location, an eight-digit birth date (YYYYMMDD), a three-digit sequence code used to distinguish individuals born on the same day in the same area, and a final ISO 7064:1983.MOD 11-2 checksum digit. This checksum is vital because it allows internal validation logic to confirm the integrity of the ID. By automating this complex calculation, mock-jutsu saves developers from the tedious task of manually scripting validation algorithms or birth-date logic during the early stages of prototyping.
Versatility is a core strength of the cn_ric function, as it is designed to fit into various modern workflows. Whether you are working directly in a Python environment, utilizing the command-line interface for quick scripts, or conducting high-concurrency performance testing via JMeter, the library provides a unified experience. For instance, a simple call to jutsu.generate('cn_ric') in Python or using the ${__mockjutsu(cn_ric,)} syntax in JMeter allows for the rapid population of test databases or the stress-testing of identity verification endpoints. This cross-platform flexibility ensures that developers can maintain a consistent flow of test data across different stages of the software development life cycle.
Beyond simple data generation, using cn_ric helps teams address complex testing scenarios, such as age-restricted access control, regional data filtering, and gender-specific logic, as the penultimate digit of the sequence code traditionally indicates sex. By incorporating these realistic identifiers, developers can identify edge cases in their sorting and filtering algorithms that might not be apparent when using generic random strings. Ultimately, mock-jutsu empowers global development teams to build more reliable, production-ready applications by providing accurate and accessible international ID formats at the touch of a button.
mockjutsu generate cn_ricmockjutsu bulk cn_ric --count 10mockjutsu export cn_ric --count 10 --format jsonmockjutsu export cn_ric --count 10 --format csvmockjutsu export cn_ric --count 10 --format sql# --mask: regulation-compliant output (PCI DSS / GDPR / KVKK)mockjutsu generate cn_ric --maskmockjutsu bulk cn_ric --count 5 --maskfrom mockjutsu import jutsujutsu.generate('cn_ric')jutsu.bulk('cn_ric', count=10)jutsu.template(['cn_ric'], count=5)# mask=True: regulation-compliant outputjutsu.generate('cn_ric', mask=True)jutsu.bulk('cn_ric', count=5, mask=True)${__mockjutsu_intl_ids(cn_ric)}# JMeter Function: __mockjutsu_intl_ids# Parameter 1: cn_ric# Parameter 2: (not required for this function)# Add 'mask' keyword to get a regulation-compliant masked value${__mockjutsu_intl_ids(cn_ric,mask)}GET /generate/cn_ric# → {"type":"cn_ric","result":"...","status":"ok"}GET /bulk/cn_ric?count=10POST /template {"types":["cn_ric"],"count":1}# mask=true: regulation-compliant outputGET /generate/cn_ric?mask=trueGET /bulk/cn_ric?count=5&mask=true| Parameter | Values | Description |
|---|---|---|
| --mask | true | false | Return a regulation-compliant masked value (PCI DSS, GDPR, KVKK…) |