link:
Cryptography Hashing
Date and Time: 2023-10-24 16:40 Status:LearningIT Tags: Cryptography
Cryptography Hashing
Intro
Hashing (also known as hash functions) in cryptography is a process of mapping a binary string of an arbitrary length to a small binary string of a fixed length, known as a hash value, a hash code, or a hash.
Hashing can be simply explained as translation from input text into resulting text of fixed size by use of the algorithm. As you can see in above examples with just a slight change of input text, result will be completely different.
Real World Hash
For example:- the infro-numric hash is the one of the basic hash version in which the sum of digits is subtracted from the number to get the hash.
This is one of the basic hash and is known for less security.
This works as follows:-
Example
Let’s take a look at an example in .Net Core with use of Hash SHA-256 algorithm. For following examples we’ll have to use System.Security.Cryptography
namespace.
In following function we are hashing texts to demonstrate how hashing works, and how results change if we just make a slight change to the text.
If we take a closer look at the ComputeHash
we can see texts are encrypted with SHA-256 algorithm.
By running the code, you’ll get following results.
Hash Functions
Hash MD5
Transclude of Hash-MD5#hash-md5
Hash SHA1
Transclude of Hash-SHA1#sha1
Hash SHA-256
Transclude of Hash-SHA-256#sha-256
Hash PBKDF2
Transclude of Hash-PBKDF2#hash-pbkdf2
Reference:
https://dev.to/stratiteq/cryptography-with-practical-examples-in-net-core-1mc4