Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crypto #6

Merged
merged 6 commits into from
Dec 8, 2023
Merged

Crypto #6

merged 6 commits into from
Dec 8, 2023

Conversation

dhruvsangamwar
Copy link
Collaborator

Added support for generating Private-Key & Public-Key pairs.
Added a standard hashing function that can be used with import.

dhruvsangamwar and others added 6 commits December 7, 2023 23:35
Added dependencies for crypto module.
Revamped for complete functionality along with extensive comments.  Also following:

Added key_size parameter in generate_keypair(key_size: usize) function
Created hash data using SHA3-256
Updated to add key_size 
/** APIs provided to create public/private key pairs and Hashing **/
    pub fn generate_keypair(key_size: usize) -> (Vec<u8>, PKey<Private>)
    //pub fn generate_keypair() -> (Vec<u8>, PKey<Private>)
    where
    {
        crypto::generate_keypair(key_size: usize)
    }
    
Added
     /** APIs provided to create hashed data using SHA3-256 **/
    pub fn hash_data(data: &str) -> String
    where
    {
        crypto::hash_data(data: &str)
    }
// Testing code for crypto module in main
    let keypair = crypto::generate_keypair(2048);
    println!("Public Key: {:?}", keypair.0);
    // Handle the private key securely
    // Printing here for testing only
    println!("Private Key: [hidden]");

    let data = "Hello, World!";
    let hashed_data = crypto::hash_data(data);
    println!("Hashed Data: {}", hashed_data);
@dhruvsangamwar dhruvsangamwar merged commit 69bb62d into main Dec 8, 2023
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants