Coder Social home page Coder Social logo

moridi / sha-256 Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 9 KB

SHA-256 is the most popular hash function in the SHA-2 family at the time of writing. It provides 128 bits of security for digital signatures and hash-only applications (SHA-1 provides only 80 bits).

Home Page: http://www.zedwood.com/article/cpp-sha256-function

License: Other

C++ 97.49% Makefile 2.51%

sha-256's Introduction

SHA-256

SHA-256 is the most popular hash function in the SHA-2 family at the time of writing. It provides 128 bits of security for digital signatures and hash-only applications (SHA-1 provides only 80 bits).

Remember that while MD5 and SHA-1 are both popular hash functions, MD5 is considered completely broken, SHA-1 is considered weak. SHA-2 and its variants are to be crowned the new king. If working on US Government projects, remember that NIST has deprecated SHA-1 in since 2010, and that SHA-2 is considered approved for for new projects.

You can use SHA-256 for password hashing, just make sure to use a random salt. Use a new random salt for each password hash to prevent the attacker from being able to pre-compute a single dictionary for all of you passwords. When apply multiple rounds, select a good work factor. For a work factor of 9, apply 2^9 (512) rounds SHA-256 then store the work factor next to the salt along with the hashed password. If you choose, you can modify your work factor later, and because the work factor is stored with the hash, still verify old password hashes.

Compile and Run (in linux):

g++ sha256.cpp main.cpp -o sha256_example && ./sha256_example

Output

sha256('grape'):0f78fcc486f5315418fbf095e71c0675ee07d318e5ac4d150050cd8e57966496

Warning

Do NOT apply this repository's code style in your project.

sha-256's People

Contributors

moridi avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.