8000 GitHub - halloweeks/sha1: sha1.h is a pure C implementation of the SHA-1 hashing algorithm. It offers both a simple function interface (SHA1()) and a SHA1_CTX structure for processing multiple data chunks. Ideal for cryptographic and security applications.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

sha1.h is a pure C implementation of the SHA-1 hashing algorithm. It offers both a simple function interface (SHA1()) and a SHA1_CTX structure for processing multiple data chunks. Ideal for cryptographic and security applications.

License

Notifications You must be signed in to change notification settings

halloweeks/sha1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

SHA-1 Implementation in C

This is a simple implementation of the SHA-1 hashing algorithm in pure C language.

Introduction

The Secure Hash Algorithm 1 (SHA-1) is a cryptographic hash function that produces a 160-bit (20-byte) hash value known as a message digest, typically rendered as a hexadecimal number, 40 digits long. It was designed by the National Security Agency (NSA) and published by the National Institute of Standards and Technology (NIST) as a U.S. Federal Information Processing Standard.

Features

  • Implemented in pure C language.
  • Supports hashing of data from memory buffers.
  • Follows the SHA-1 specification as outlined in FIPS PUB 180-1.
  • Provides both a simple function interface (SHA1()) and a SHA1_CTX structure for processing multiple chunks of data.

Usage

Using the SHA1() Function

#include "sha1.h"

int main() {
    unsigned char data[] = "Hello, World!";
    unsigned char hash[SHA1_BLOCK_SIZE];

    SHA1(data, sizeof(data) - 1, hash);

    // Print or use the hash as needed
    return 0;
}

Using the SHA1_CTX Structure

#include "sha1.h"

int main() {
    unsigned char data1[] = "Hello, ";
    unsigned char data2[] = "World!";
    unsigned char hash[SHA1_BLOCK_SIZE];
    
    SHA1_CTX ctx;

    SHA1_Init(&ctx);
    SHA1_Update(&ctx, data1, sizeof(data1) - 1);
    SHA1_Update(&ctx, data2, sizeof(data2) - 1);
    SHA1_Final(&ctx, hash);

    // Print or use the hash as needed
    return 0;
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

sha1.h is a pure C implementation of the SHA-1 hashing algorithm. It offers both a simple function interface (SHA1()) and a SHA1_CTX structure for processing multiple data chunks. Ideal for cryptographic and security applications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0