ec-validator
High-performance validation library for Ecuadorian government IDs and financial data.
Quick Start
use ;
// Validate a Cédula (national ID)
assert!;
// Validate a RUC (taxpayer ID)
assert!;
// Validate an Ecuadorian IBAN
assert!;
Features
| Feature | Description | Default |
|---|---|---|
serde |
Enable Serialize/Deserialize derives | No |
wasm |
Enable WebAssembly bindings | No |
Validation Rules
Cédula de Identidad (10 digits)
The Ecuadorian national ID uses a Mod-10 algorithm. First two digits must be a valid province code (01–24). Third digit must be 0–6 for natural persons. The tenth digit is a check digit calculated using alternating weights [2,1,2,1,2,1,2,1,2].
RUC (13 digits)
The Registro Único de Contribuyentes has three variants:
- Natural Person (3rd digit 0–5): First 10 digits must pass Cédula validation; establishment code (digits 11–13) must be 001–999.
- Juridical Entity (3rd digit 9): Province code 01–24; check digit at position 10 using Mod-11 weights [4,3,2,7,6,5,4,3,2]; establishment 0001–9999.
- Public Entity (3rd digit 6): Province code 01–24; check digit at position 9 using Mod-11 weights [3,2,7,6,5,4,3,2]; establishment 0001–9999.
IBAN (24 characters)
Ecuadorian IBANs follow ISO 13616. Must start with "EC", be exactly 24 characters, and pass Mod-97 validation after rearranging (first 4 characters moved to end).
WebAssembly
Contributing
Test data is sourced from publicly available Ecuadorian government ID validation references including SRI specifications and international IBAN standards. When contributing new validation rules or test data, please cite relevant official sources.
License
MIT