When developing software for the Southeast Asian market, particularly Thailand, engineers frequently encounter the need for valid Thai Personal Identification Numbers to populate their databases and test validation logic. The mock-jutsu library addresses this requirement through the th_pin function, a dedicated generator within the IntlIDs category. This function is designed to produce 13-digit identifiers that mimic the structure of real Thai identity cards, providing high-quality mock data for developers who need to ensure their systems are compatible with local administrative standards.
The technical accuracy of the th_pin function is maintained by its strict adherence to the MOD-11 checksum algorithm. In a standard Thai ID, the first twelve digits represent various demographic details, while the final digit acts as a check bit calculated using a specific weighted sum. By implementing this algorithm, mock-jutsu ensures that every generated string is mathematically valid. This is particularly beneficial when testing front-end input masks or back-end verification services that would otherwise reject randomly generated numbers. Developers can easily access this functionality via the Python interface with jutsu.generate('th_pin') or through the CLI for rapid prototyping by executing mockjutsu generate th_pin.
Beyond simple unit tests, the th_pin function is an invaluable asset for large-scale integration and performance testing. For instance, teams using JMeter can utilise the ${__mockjutsu(th_pin,)} syntax to inject realistic test data into high-concurrency scenarios, such as stress-testing a national insurance portal or a banking application. Using authentic-looking test data helps identify edge cases in sorting, indexing, and data retrieval that might be missed with generic numeric strings. It also ensures that the application’s user interface remains visually consistent with real-world usage patterns during stakeholder demonstrations.
Ultimately, incorporating th_pin into your development lifecycle enhances both security and efficiency. By using synthetic mock data, teams can avoid the legal and ethical complexities associated with handling actual personally identifiable information (PII) during the testing phase. The mock-jutsu library simplifies the process of generating these complex identifiers, allowing developers to focus on building features rather than manual data entry. Whether you are seeding a development database or automating a CI/CD pipeline, this function provides the reliability and precision required for modern, internationalised software engineering.
mockjutsu generate th_pinmockjutsu bulk th_pin --count 10mockjutsu export th_pin --count 10 --format jsonmockjutsu export th_pin --count 10 --format csvmockjutsu export th_pin --count 10 --format sql# --mask: regulation-compliant output (PCI DSS / GDPR / KVKK)mockjutsu generate th_pin --maskmockjutsu bulk th_pin --count 5 --maskfrom mockjutsu import jutsujutsu.generate('th_pin')jutsu.bulk('th_pin', count=10)jutsu.template(['th_pin'], count=5)# mask=True: regulation-compliant outputjutsu.generate('th_pin', mask=True)jutsu.bulk('th_pin', count=5, mask=True)${__mockjutsu_intl_ids(th_pin)}# JMeter Function: __mockjutsu_intl_ids# Parameter 1: th_pin# Parameter 2: (not required for this function)# Add 'mask' keyword to get a regulation-compliant masked value${__mockjutsu_intl_ids(th_pin,mask)}GET /generate/th_pin# → {"type":"th_pin","result":"...","status":"ok"}GET /bulk/th_pin?count=10POST /template {"types":["th_pin"],"count":1}# mask=true: regulation-compliant outputGET /generate/th_pin?mask=trueGET /bulk/th_pin?count=5&mask=true| Parameter | Values | Description |
|---|---|---|
| --mask | true | false | Return a regulation-compliant masked value (PCI DSS, GDPR, KVKK…) |