Skip to content

An implementation of the SHA256 Hashing Algorithm in C

License

Notifications You must be signed in to change notification settings

Thehbadger/SHA256-in-C

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SHA256-in-C

An implementation of the SHA256 Hashing Algorithm in C

What is the SHA256 Hashing Algorithm?

SHA-2 (Secure Hash Algorithm 2) is a set of cryptographic hash functions designed by the United States National Security Agency (NSA).

The standard for the algorithm can be found here.

Setup/Install

The only thing you need to compile and/or run the script is a copy of the C compiler.

  • Windows - www.mingw.org
  • Linux - sudo apt-get install build-essential
  • Solus - sudo eopkg install -c system.devel
  1. Compile - gcc SHA256.c -o SHA256
  2. Execute - ./SHA256 testFile1.txt

Implementation

The project was done under the guidance of video lectures uploaded by Ian McLoughlin.

During the implementation of the project, research about the algorthim and it's standards was undertaken to try and better understand the intricacies of the algorthim.

The script correctly calculates the correct hash, this can be seen here. To fix the problem of the algorthim giving an incorrect hash, I had to add a missing 2 to my K constant variable and change some of the SIG functions.

Screenshot from 2019-03-31 14-33-18

Check correctHashes.txt for more info.

The correct hashes for the given strings are as follows

  • abc = ba7816bf 8f01cfea 414140de 5dae2223 b00361a3 96177a9c b410ff61 f20015ad
  • = e3b0c442 98fc1c14 9afbf4c8 996fb924 27ae41e4 649b934c a495991b 7852b855
  • abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq = 248d6a61 d20638b8 e5c02693 0c3e6039 a33ce459 64ff2167 f6ecedd4 19db06c1

Research

About

An implementation of the SHA256 Hashing Algorithm in C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 100.0%