This repository contains an end-to-end system for privacy-preserving fingerprint authentication. It addresses a fundamental problem in biometric security: How can we use a fingerprint to unlock a strong cryptographic key without ever storing the fingerprint (or the raw key) in a vulnerable database?
By combining deep learning-based feature extraction with a custom C-implementation of BCH error-correcting codes, this system generates cancelable (revocable) biometric templates that are cryptographically bound to a secret key.
License Notice: This project is licensed under the GNU General Public License (GPL). It utilizes custom C-implementations for BCH error correction combined with Python wrappers.
Key Features & Unique Contributions
End-to-End Cancelable Biometrics: A complete pipeline from image preprocessing to secure key recovery.
Binary Deep Embeddings: Utilizes a ResNet-50 backbone with Straight-Through Estimator (STE) quantization and entropy-aware training for optimal bit distribution.
Orthogonal L2FE-Hash: Implements a chaotic orthogonal projection to ensure templates are revocable without intra-class distortion.
Practical Fuzzy Commitment: Uses a custom BCH implementation to simulate real-world bit errors, allowing for varying degrees of fault tolerance ($t$).
Memory-Efficient Training: Optimized for consumer GPUs using Mixed Precision (AMP) and a custom PK Sampler.
How the System Works
1. Enrollment (Binding the Key)
Enrollment Flow
Figure 1: Cryptographic Binding and Vault Enrollment
Feature Extraction: A user provides a fingerprint and a secret password. A trained neural network converts the fingerprint into a 512-bit binary string ($R_{bio}$).
Revocable Hashing: The password is hashed to generate a chaotic orthogonal matrix ($R_{key}$). $R_{bio}$ is projected with $R_{key}$ and binarized to produce a cancelable template ($T_{prot}$).
Fuzzy Vault Creation: A fresh random cryptographic key ($S$) is encoded using a BCH error-correcting code into a codeword ($C$).
Storage: The system computes the helper data $H = C \oplus T_{prot}$. Only $H$ and a hash of $S$ are stored. The raw template, password, and raw key are destroyed.
2. Authentication (Recovering the Key)
Authentication Process
Figure 2: Key Recovery and Authentication
The user provides their fingerprint and password, generating a query template ($T_{prot}'$).
The system retrieves $H$ and computes $C' = H \oplus T_{prot}'$.
The custom BCH decoder attempts to correct the error pattern between the enrolled and query templates ($T_{prot} \oplus T_{prot}'$).
If the Hamming distance is $\le t$ (the correction capacity), the decoder recovers $S' = S$. The hash is verified, and the key is released for use.
Deep Learning Architecture
Training Architecture
Figure 3: Deep Learning Training Pipeline
The Backbone
The feature extractor is a ResNet-50 pretrained on ImageNet, heavily modified to perform differentiable quantization. The 512-dimensional output is squashed via Sigmoid and rounded using a Straight-Through Estimator (STE), allowing standard gradient descent to produce a 512-bit binary string.
The Loss Function
To prevent binary collapse (all zeros or ones), we employ a two-term loss combining angular margins and information theory:
$$L = L_{ArcFace} - \lambda \cdot L_{Entropy}$$
ArcFace Loss: Pushes embeddings of the same identity together while separating different identities.
Min-Entropy Loss: Forces the average bit probability to 0.5, maximizing Shannon entropy so the 512 bits are uniformly random. The hyperparameter $\lambda$ is linearly annealed over the first 10 epochs.
Datasets & Preprocessing
The model was trained and evaluated on four public fingerprint datasets using stratified train/val splits:
Pad-to-square (aspect-ratio-preserving resize to 224x224)
3-channel stacking (for ResNet compatibility)
ImageNet normalization
Random affine augmentations (training only)
Performance & Benchmarks
The system was rigorously evaluated across four heterogeneous datasets (CMBD, CASIA, FVC2000, FVC2004) against multiple advanced threat models.
Threat Model Equal Error Rates (EER)
Our dynamic Bio-Hashing achieves near-perfect separation in Zero-Effort scenarios, while safely relying on the robust ArcFace embeddings during severe "Stolen Token" attacks.
Dataset
Raw Backbone EER
Bio-Hashed (Zero-Effort)
Stolen Key EER
CMBD
0.00%
0.00%
0.00%
CASIA
3.11%
0.00%
3.50%
FVC2000
2.83%
0.01%
4.47%
FVC2004
4.59%
0.00%
6.35%
Cryptographic Security Trade-offs (Fuzzy Vault)
Evaluating a fuzzy vault requires balancing biometric usability (Genuine Accept Rate) against cryptographic entropy. By utilizing a custom C-level BCH implementation, we can push the error-correction capacity ($t$) to unprecedented levels.
The Security Level (in bits) is quantified as:
$$Security = 512 - \log_2\left(\sum_{i=0}^{t} \binom{512}{i}\right)$$
Dataset
BCH Capacity ($t$)
GAR (%)
Stolen FAR (%)
Security (Bits)
CASIA
120
97.81%
9.12%
113.9
CASIA
150
99.80%
50.55%
69.2
FVC2000
120
36.28%
0.01%
113.9
FVC2000
150
61.94%
0.13%
69.2
FVC2004
120
21.23%
0.08%
350.9
FVC2004
150
70.79%
1.31%
249.1
Note: Achieving AES-equivalent cryptographic security levels (114-250+ bits) while maintaining acceptable GAR is a significant leap forward for fuzzy biometric systems. For example, a strict vault ($t=60$) on CASIA drops GAR to 75% but provides 249 bits of security.