The cn_ric function within the mock-jutsu library is a specialised tool designed for developers and QA engineers who require authentic Chinese Resident Identity Card numbers for their software environments. This function generates a string of eighteen characters that strictly adheres to the GB 11643-1999 standard, ensuring that the produced test data is structurally indistinguishable from real-world identifiers. By using mock-jutsu to automate the creation of these identifiers, teams can bypass the complexities of manual data generation while maintaining high standards of data integrity and privacy compliance.
Each identifier produced by the cn_ric generator is composed of four distinct segments: a six-digit administrative division code representing the individual's registered area, an eight-digit date of birth, a three-digit sequence code, and a final checksum character. The algorithm ensures that the birth date is valid and that the sequence code correctly identifies gender, where odd numbers represent males and even numbers represent females. Most importantly, the final character is calculated using the ISO 7064:1983.MOD 11-2 modular arithmetic method, which may result in a digit or the letter 'X'. This level of precision is essential for testing validation logic in applications, as it allows the mock data to pass through rigorous checksum filters that would reject simple random strings.
Incorporating cn_ric into your workflow is seamless across various platforms. Python developers can invoke it directly via jutsu.generate('cn_ric'), while those working in performance testing can utilise the JMeter syntax ${__mockjutsu(cn_ric,)}. For quick local testing or shell scripting, the command-line interface provides immediate output through the mockjutsu generate cn_ric command. This versatility makes it an indispensable asset for simulating Know Your Customer (KYC) processes, verifying database constraints, or populating user profiles in a staging environment.
Beyond simple functionality, using mock-jutsu for generating cn_ric values offers significant security benefits. By utilising synthetic test data instead of real PII, organisations can mitigate the risks associated with data breaches during the development lifecycle. This approach not only ensures compliance with international data protection regulations but also empowers developers to stress-test their systems with a diverse range of valid inputs. Whether you are building a complex financial platform or a regional service portal, this function provides the reliable, high-quality data necessary for robust software delivery.
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…) |