SAuth2.0 is an advanced multi-factor authentication system that enhances security by incorporating handwritten digit recognition as a second verification step. This project combines traditional password authentication with machine learning-based handwriting recognition to provide robust security without compromising user privacy.
- Multi-Factor Authentication: Combines password (something you know) with handwritten input (something you do)
- Enhanced Security: Adds an additional layer of verification beyond passwords
- Privacy Preservation: Avoids dependence on biometric data or device-centric methods
- High Accuracy: Achieves 96.3% accuracy on training data and 98.48% on external validation data
- Multiple ML Models: Implements and compares Random Forest, Logistic Regression, CNN, and LSTM approaches
SAuth2.0 addresses existing vulnerabilities in user authentication by establishing an optimal balance between user privacy and sensitive data protection. The system aims to mitigate both current security weaknesses and emerging threats through a multi-layered approach.
- User enters their password (first authentication factor)
- System prompts the user to handwrite a specific digit using touch input or stylus
- Machine learning model processes the handwritten input
- Authentication is granted or denied based on accurate recognition
- If recognition fails, the user is prompted to re-enter the digit
The project implements and compares several machine learning approaches:
| Model | MNIST Accuracy | Kaggle Dataset Accuracy |
|---|---|---|
| Random Forest (Model 1) | 96.3% | 98.46% |
| Random Forest (Model 2) | 95.8% | 98.04% |
| Logistic Regression | 91.2% | 83.96% |
| CNN | 99.76% | 99.56% |
| LSTM | 99.11% | 98.99% |
SAuth2.0/
├── 1_Train_Random_Forest_Model_1.py # Trains base Random Forest model
├── 2_Train_Random_Forest_Model_2.py # Trains tuned Random Forest model
├── 3_Train_Logistic_Regression_Model.py # Trains Logistic Regression model
├── 4_Test_All_Models_Kaggle_DataSet.py # Tests all models on Kaggle dataset
├── 5_Plot_Comparision_Graphs.py # Generates comparison visualizations
├── 6_Plot_MNIST_Dataset_Details.py # Analyzes and visualizes MNIST data
├── 7_CNN_LSTM_Model_Train_MNIST.py # Trains CNN and LSTM models
├── 8_CNN_LSTM_Model_Predict_Kaggle.py # Tests CNN and LSTM on Kaggle data
├── AI_ML.ipynb # Jupyter notebook with all code
├── README.md # Project documentation
└── models/ # Saved model files
├── random_forest_mnist.joblib
├── random_forest_model_2_mnist.joblib
├── logistic_regression_mnist.joblib
├── CNN_Model_1.h5
└── LSTM_Model.h5
The project utilizes two primary datasets:
- MNIST Dataset: 60,000 training samples and 10,000 testing samples of handwritten digits (28x28 pixels)
- Kaggle Dataset: External validation dataset for comprehensive model testing
- Python 3.8+
- TensorFlow 2.x
- scikit-learn
- pandas
- numpy
- matplotlib
- joblib
-
Clone the repository:
git clone https://github.com/yourusername/SAuth2.0.git cd SAuth2.0 -
Install dependencies:
pip install -r requirements.txt
-
Download the Kaggle dataset:
- Visit https://www.kaggle.com/competitions/digit-recognizer/data
- Download the
train.csvfile and place it in the project directory
To train the Random Forest model:
python 1_Train_Random_Forest_Model_1.pyTo test all models on the Kaggle dataset:
python 4_Test_All_Models_Kaggle_DataSet.pyTo visualize dataset details:
python 6_Plot_MNIST_Dataset_Details.pyTo train CNN and LSTM models:
python 7_CNN_LSTM_Model_Train_MNIST.pyAfter rigorous testing and evaluation, the project demonstrated:
- CNN model achieved the highest accuracy (99.56% on Kaggle dataset)
- Random Forest models performed exceptionally well (98.46% accuracy) with lower computational requirements
- Logistic Regression provided a solid baseline (83.96% accuracy) but proved less effective for this application
- All models except Logistic Regression maintained or improved performance when tested on the external Kaggle dataset
Building on the success of SAuth2.0, future development will focus on:
- SAuth4.0: Enhancing security by recognizing user-specific handwriting styles
- Multi-language Support: Extending capabilities to other scripts like Devanagari for Hindi
- Improved Accessibility: Adapting to alternative input methods for inclusive user experience
Key takeaways from this project include:
- The importance of careful parameter selection for model accuracy
- The value of testing models on multiple datasets
- The balance between model complexity and performance
- The impact of data quality on recognition accuracy
- Pirege Compliance. (2020). The Importance of Multifactor Authentication for Compliance and Safety. Link
- TensorFlow. (2023). Keras: The high-level API for TensorFlow. Link
- Kaggle. (2021). Dataset for SAuth4.0. Link
- Kaggle. Dataset for Hindi Character Recognition. Link
- Medium. (2019). Dataset and information on Devanagari. Link
Shivansh Mishra
This project is licensed under the MIT License - see the LICENSE file for details.

