This project utilizes FastAPI to receive requests and generate hash codes in response. The application is hosted on AWS.
This FastAPI application provides an API to receive text and generate different types of hash codes, such as MD5, SHA-1, SHA-256, and more.
- Hash code generation for the provided text.
- Hash code generation for files and multiple text.
- Supports various hash algorithms, including MD5, SHA-1, SHA-256, etc.
- Deployment on AWS for remote access.
-
Clone this repository:
git clone https://github.com/rmp2000/hash_fastapi.git
-
Create a virtual environment and activate it:
cd hash_fastapi python -m venv venv source venv/bin/activate # For Windows: venv\Scripts\activate
-
Install the dependencies:
pip install -r requirements.txt
-
Run the FastAPI application:
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
-
Access the API at http://localhost:8000 and use the specified endpoints.
-
/hash/algorithm/{algorithmStr}/value/{valueStr}: Generate a hash code for the provided text using the specified algorithm. -
/hash/algorithm/{algorithmStr}/value/{valueStr}/salt/{saltStr}: Generate a hash code, of the value provided using the hash algorithm selected and adding salt before hasing. -
/hash/algorithm/{algorithmStr}/value/{valueStr}/pepper/{pepperStr}: Generate a hash code, of the value provided using the hash algorithm selected and adding peper after hasing. -
/hash/compare/algorithm/{algorithmStr}/value/{valueStr}/hash/{hashStr}: Return True if the hash is equal to the value hashed using the algorithm selected otherwise return False. -
/hash/compare/algorithm/{algorithmStr}/salt/{saltStr}value/{valueStr}/hash/{hashStr}: Compare Hash adding salt", description="Return True if the hash is equal to the value hashed using the algorithm selected and adding salt otherwise return False. -
/hash/compare/algorithm/{algorithmStr}/pepper/{pepperStr}value/{valueStr}/hash/{hashStr}: Return True if the hash is equal to the value hashed using the algorithm selected and adding pepper otherwise return False. -
/hash/multiple/algorithm/{algorithmStr}: Return a list of hash using the algorithm selected. -
/hash/multiple/algorithm/{algorithmStr}/salt/{saltStr}: Return a list of hash using the algorithm selected adding salt before hasing. -
/hash/multiple/algorithm/{algorithmStr}/pepper/{pepperStr}: Return a list of hash using the algorithm selected and adding pepper after hasing. -
/hash/multiple/file/algorithm/{algorithmStr}: Return the hash of the File provided using the algorithm selected.Example usage:
curl -X GET "http://localhost:8000/hash/algorithm/md5/value/hello"
This api is depoid in AWS in http://localhost:8000].
Documentation in Api Docs
If you wish to contribute to this project, we welcome collaborations!