The ssn function within the mock-jutsu library provides a robust solution for developers and QA engineers who need to generate realistic US Social Security Numbers for their applications. As a cornerstone of the identity category, this function ensures that the generated mock data adheres to the specific formatting and structural rules established by the Social Security Administration. Rather than producing random nine-digit strings, mock-jutsu generates values in the standard XXX-XX-XXXX format, ensuring that the test data looks and behaves like authentic identification numbers during the development lifecycle.
What sets this function apart is its strict adherence to historical area and group number rules. The algorithm ensures that the generated ssn does not fall into invalid ranges, such as those starting with 000, 666, or the 900-999 series, which are not currently issued. By simulating these specific constraints, mock-jutsu allows teams to test input masks, database constraints, and validation logic without the risk of using real personally identifiable information (PII). This is critical for maintaining data privacy and achieving compliance with regulations like GDPR or HIPAA during the testing phase.
Integrating this functionality into your workflow is seamless across various environments. Whether you are using the Python API with jutsu.generate('ssn'), running a quick command via the CLI with mockjutsu generate ssn, or performing load testing in JMeter using the ${__mockjutsu(ssn,)} syntax, the library provides consistent and reliable results. This versatility makes it an essential tool for backend developers seeding databases and performance testers simulating thousands of unique user profiles simultaneously.
Ultimately, the ssn function simplifies the complex task of creating high-fidelity test data. By automating the generation of valid-format identifiers, mock-jutsu reduces the manual effort involved in data preparation and minimizes the potential for human error. Developers can focus on building features while knowing their validation scripts are being challenged by data that mirrors real-world scenarios. This leads to more resilient applications and a faster time-to-market, as edge cases related to identity formatting are addressed long before the code reaches a production environment.
mockjutsu generate ssnmockjutsu bulk ssn --count 10mockjutsu export ssn --count 10 --format jsonmockjutsu export ssn --count 10 --format csvmockjutsu export ssn --count 10 --format sql# --mask: regulation-compliant output (PCI DSS / GDPR / KVKK)mockjutsu generate ssn --maskmockjutsu bulk ssn --count 5 --maskfrom mockjutsu import jutsujutsu.generate('ssn')jutsu.bulk('ssn', count=10)jutsu.template(['ssn'], count=5)# mask=True: regulation-compliant outputjutsu.generate('ssn', mask=True)jutsu.bulk('ssn', count=5, mask=True)${__mockjutsu_identity(ssn)}# JMeter Function: __mockjutsu_identity# Parameter 1: ssn# Parameter 2: (not required for this function)# Add 'mask' keyword to get a regulation-compliant masked value${__mockjutsu_identity(ssn,mask)}GET /generate/ssn# → {"type":"ssn","result":"...","status":"ok"}GET /bulk/ssn?count=10POST /template {"types":["ssn"],"count":1}# mask=true: regulation-compliant outputGET /generate/ssn?mask=trueGET /bulk/ssn?count=5&mask=true| Parameter | Values | Description |
|---|---|---|
| --mask | true | false | Return a regulation-compliant masked value (PCI DSS, GDPR, KVKK…) |