What is a Hash + How to Do it?

in #security8 years ago (edited)

global-security-1734189_1280.jpg

A hash is essential for cryptographic operations, and here in the crypto-coin space everyone is using hashes, but do you know what they are or how they work. Let me explain it to your briefly in ELI5 mode, and then we will practice it.

A hash function is a cryptographic function that transforms digital information into a deterministic fixed size static output, called hash sum or hash, that will always be a derivation of that particular information in that exact particular order.

A small deviation in the data and the hash sum will be entirely different. This is called the Avalance Effect, and it's useful to record data exactly precisely, and to detect even minuscule tampering with the data.

It's basically a digital fingerprint of a set of data, if you will. Needless to say that Bitcoin and every other cryptocurrency could not exist without it, because the entire blockchain system is dependent on this technology.

One more important thing is that a hash is non invertible, meaning that you can hash a data into a sum, but you can't retrieve the data from the sum. Also the function can hash immensely large information, although not always unlimited, the SHA-2 family can contain up to 2128 − 1 bits of data, while the SHA-3 family is unlimited.

MOST COMMON:

  • MD5 - Commonly seen in older CD/DVD's to check their integrity. It is not secure anymore and it's being replaced by new ones.
  • SHA-256 - It is the industry standard at the moment, very highly reviewed, and everything depends on this one, including all cryptocurrencies.
  • SHA-512 - An 512 key version of the SHA-2 family, it is 2x more secure than SHA-256, however it's not as well tested, so it's not as popular.
  • SHA-3 Family - A new family of hashes, also called Keccak, it is still experimental, and needs more testing before it should be safely used.

DO IT YOURSELF

If you are on Linux , just enter this in the console:

echo -n YOURTEXTGOESHERE | sha256sum
echo -n YOURTEXTGOESHERE. | sha256sum

hash.png

As you can see, if you include a small . dot after the text, it results in a completely different hash, and this is very good, because the hash will always be unique to your data. The risk of collision is extremely small.

You can now use hashes to record your data, version it, and know exactly if any modifications (no matter how tiny) have been done with your data.

It's extremely useful for accounting, security analysis, blockchains, you name it. In Bitcoin everything is hashed, basically your transaction ID, is just a SHA-256 hash of your transaction data, and a block header is just a hash of the previous block, the entire "chain" in the blockchain is achieved with hashing, and without this, there would be no cryptocurrencies.


Upvote, ReSteem & bluebutton



button2x
Sort:  

Great explanation and easy to understand. Thank you.

Great post! Here's a powershell script for hash checking on windows: https://gallery.technet.microsoft.com/PowerShell-File-Checksum-e57dcd67

Coin Marketplace

STEEM 0.20
TRX 0.12
JST 0.029
BTC 61680.81
ETH 3443.96
USDT 1.00
SBD 2.51