Hashing for non-technical people

Hashing for non-technical people

A simple explanation of how hashing works and its applications. A soon-to-be lawyer asked me recently: what should I know about the latest technological advancements to be a well-rounded professional going forward?

A soon-to-be lawyer asked me recently: what should I know about the latest technological advancements to be a well-rounded professional going forward?

We talked a bit about everything — AI, Blockchain, and all the other buzzwords. And naturally, we touched upon the concept of hashing — where people usually get stuck on.

At a high level, encryption, for example, is quite intuitive. You “lock” something with a key and then unlock it by using the appropriate key.

Hashing, however, is hard to grasp even at a high level. Hashes are one-way functions that generate a deterministic output from a given input, such that the output (hash) can be used to identify and validate the input, without revealing anything about it.

What’s difficult about the concept is that the function is one-way only. You run an input through a mathematical function and get an output that cannot be reversed. But how could that be? If I know the function and I know the output, I can surely derive the input, no?

Rethinking mathematical operators

For the majority of us, when we think about mathematical operators, we think of operators for addition, subtraction, multiplication, and division. Hence, the concept of hashing seems unreasonable.

Let’s say we have a function f(x) = x + 2.

If I give you the output, say y = 4, you can easily work back the function and find that x = 2.

But while that is true for the four operators mentioned above, it is not true for all operators in existence.

Introducing the modulo operator

Don’t worry — it’s not gonna get too complicated

The modulo operator, usually defined by the symbol % (yup, that’s right), gives us the remainder of a division of two whole numbers.

Here are a few examples:

4 % 2 = 0 (pronounced ‘four modulo two equals zero’)

5 % 2 = 1

6 % 4 = 2

Did you get the hang of it? First, we figure out the maximum amount of times the second number fits into the first. Then, the modulo operator will give a result of whatever is leftover.

2, for instance, fits twice into 5, and the remainder is 1. Hence, 5 % 2 = 1.

I get it, now why is this important?

Remember our function f(x) from the beginning?

Now let’s say f(x) = x % 2.

I tell you y = 0. Can you find x?

While your brain might intuitively think x = 2, the truth is: x can be 2, or an infinite amount of other numbers.

Think about it: 4 % 2 is also 0, so is 10 % 2 and so is 935628038264 % 2.

Hence, in practice, you could never figure out what x is because the different values it can take are infinite. Any even number between 2 and infinity modulo 2 will equal 0.

software-engineering technology blockchain cybersecurity programming

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Software Developer vs Software Engineer — Differences: Bogus or Real?

In this article, see if there are any differences between software developers and software engineers. What you’re about to read mostly revolves around my personal thoughts, deductions, and offbeat imagination. If you have different sentiments, add them in the comment section, and let’s dispute! So, today’s topic…

5 Blockchain Applications That Have Transformed the World of Technology

The blockchain is the decentralized database of the blocks of information, which gets recorded in the chain format and linked in a secured crypto graphical manner. This technology ensures proper safety of the data due to its secure nature, and it totally changes how people carry out transactions. It also brings about a faster and secure process of validating information needed to establish reliability.

Do’s and Don’ts of Blockchain Programming

Just buried into code and developing stuff. Or else? Here’s do and don ts of blockchain programming with a year of experience. Before starting, you don’t want to get stuck with a platform because you don’t know the language.

Top 10 Best Blockchain Programming Language for Blockchain Programmer

We aim at equipping you with every necessary knowledge of the best programming languages for blockchain and you'll learn more 10 Best Blockchain Programming Language for Programmer: C++, Java, Python, Ruby, Solidity, Go, JavaScript...

Revolutionary Application of Blockchain Technology

Our Blockchain Online Training will provide you to learn about Blockchain technology aspects with realty. Our Blockchain Course also includes live sessions, live Projects