Skip to content

This contains the cryptographic hash functions written from scratch

Notifications You must be signed in to change notification settings

bp7968h/cryptography

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cryptography

This repository is dedicated to exploring and implementing various cryptographic hash functions in Rust, starting with SHA-1. The primary goal of this project is educational, aimed at understanding the mechanisms and applications of hash functions in cryptography.

Getting Started

Prerequisites

Ensure you have Rust installed. If not, you can install it by following the instructions on the official Rust website.

Installation

Clone the repository to begin exploring the hash functions:

git clone https://github.com/bp7968h/cryptography.git
cd cryptography

Implemented Algorithms

SHA-1

SHA-1 (Secure Hash Algorithm 1) is a cryptographic hash function which produces a 160-bit hash value known as a message digest. Although SHA-1 has been found to be vulnerable to certain types of attacks and is no longer recommended for security-critical cryptographic purposes, it remains widely used for general checksum purposes and in non-critical applications due to its speed.

Usage

To use the SHA-1 function in your Rust code, first ensure you have the library included in your Cargo.toml:

[dependencies]
cryptography = { git = "https://github.com/bp7968h/cryptography.git" }

Then, you can compute a SHA-1 hash as follows:

use cryptography::SHA1;

fn main() {
    let mut sha1 = SHA1::new();
    let result_arr: Vec<u8> = sha1.hash("example");
    
    let result = result_arr.iter().map(|b| format!("{:02x}", b)).collect::<String>();
    println!("SHA-1 hash: {}", result);
}

To be Continued, Any suggestions are welcomed

About

This contains the cryptographic hash functions written from scratch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages