1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Copyright 2026 Regit.io — Nicolas Koenig
// SPDX-License-Identifier: Apache-2.0
//! Securities identifier validation in pure Rust — `#![no_std]`, no `alloc`,
//! zero dependencies.
//!
//! `regit-identifiers` parses, validates, and converts the identifiers that
//! name a security or a market: ISIN, CUSIP / CINS, SEDOL, LEI, BIC, MIC,
//! FIGI, CFI, and the national numbers WKN and VALOR.
//!
//! An identifier is the primary key of a security: a trade is routed, a
//! position is settled, and a holding is reported to a regulator against it.
//! If a malformed or mistyped identifier is accepted as valid, every one of
//! those operations is wrong. This crate's first duty is therefore to never
//! certify a bad identifier as good. For every identifier that carries a
//! check digit, the digit is recomputed from its governing standard and
//! verified — never trusted. Structural rules are enforced exactly as the
//! standard specifies.
//!
//! The crate is `#![no_std]` and allocation-free: every identifier is a
//! fixed-size byte array, every algorithm is hand-rolled integer arithmetic,
//! and there is no runtime dependency. The same audited logic runs in a
//! backend service, a WASM bundle, or on an embedded device.
//!
//! # Quick start
//!
//! ```
//! use regit_identifiers::checkdigit;
//!
//! // Recompute the check digit of Apple's ISIN body — never trust the
//! // digit you were given.
//! assert_eq!(checkdigit::isin_check_digit("US037833100").unwrap(), '5');
//!
//! // A securities identifier is, at its core, a check-digit scheme over an
//! // alphanumeric alphabet — that core is exposed directly.
//! assert_eq!(checkdigit::cusip_check_digit("03783310").unwrap(), '0');
//! assert_eq!(checkdigit::sedol_check_digit("026349").unwrap(), '4');
//! assert_eq!(checkdigit::figi_check_digit("BBG000BLNNH").unwrap(), '6');
//! ```
//!
//! # Architecture
//!
//! ```text
//! errors typed errors — ValidationError, ConversionError
//! charset ASCII alphabet primitives (internal)
//! checkdigit check-digit algorithms — ISIN, CUSIP, SEDOL, LEI, FIGI
//! country ISO 3166-1 alpha-2 codes and ISIN prefix rules
//!
//! isin ISIN — ISO 6166 cusip CUSIP / CINS — ANSI X9.6
//! sedol SEDOL — LSE Masterfile lei LEI — ISO 17442
//! figi FIGI — ANSI X9.145 bic BIC — ISO 9362
//! mic MIC — ISO 10383 cfi CFI — ISO 10962
//! wkn WKN — national (DE) valor VALOR — national (CH)
//!
//! convert cross-identifier conversions (ISIN ⇄ CUSIP / SEDOL / VALOR)
//! detect SecurityId — unified type + auto-detection
//! mic_registry embedded ISO 10383 registry (feature `mic-registry`)
//! ```
//!
//! Every rule is traced to a citable standard — ISO 6166, ISO 17442,
//! ISO 9362, ISO 10383, ISO 10962, ISO 7064, and the CUSIP, SEDOL, and FIGI
//! specifications — in the doc comment of the module that implements it.
//!
//! Part of [Regit OS](https://www.regit.io) — the operating system for
//! investment products. From Luxembourg.
/// Embedded snapshot of the ISO 10383 Market Identifier Code registry.
/// Enabled by the default `mic-registry` feature.
pub use Bic;
pub use Cfi;
pub use Cusip;
pub use ;
pub use ;
pub use Figi;
pub use Isin;
pub use Lei;
pub use Mic;
pub use Sedol;
pub use Valor;
pub use Wkn;
/// `MicEntry` and `MicStatus` are re-exported at the crate root for
/// ergonomic access — both originate in [`mic_registry`] and travel with the
/// `mic-registry` feature.
pub use ;