Featured
- Get link
- X
- Other Apps
Hashing
Hashing is the process which converts a simple plain text into a text which is not the same text entered. You can think like that after hashing the text is now with mix letters which does not make any sense. Hashing is an algorithm that is used for keeping password database so that if a hacker hacks your database than hacker cannot know the password because it is not password it is hash.
There are many hashing algorithm like md-5, sha256, RSA etc. Hashing algorithm is an encryption algorithm. In different programming language we can convert a word or phrase into hash so that we can keep the word or phrase secret. You know that password is very important because much people sign in in different website. If there password is strong than while converting into simple text it can take lots of time to know. Which means that your password is very secure and strong.
In different programming the way of writing the program for converting a text into hash may be different but at last we get the output same. For example:
In python if make a program to convert the phrase 'Hello world' into md5 hash it will give result 3e25960a79dbc69b674cd4ec67a72c62. And If you wish to try in php language it also going to give you same result because word is same 'Hello world'. The syntax comparison is given below:
In Python
import hashlib
result = hashlib.md5(b'Hello world')
print(result.hexdigest())
Output: 3e25960a79dbc69b674cd4ec67a72c62
In Php
<?php
$str = "Hello world";
$a = "3e25960a79dbc69b674cd4ec67a72c62";
echo md5($str);
?>
Output:
3e25960a79dbc69b674cd4ec67a72c62
Here both the result is same. But in case of bcrypt means blowfish algorithm every time you run the program you are going to get new hash for same word or phrase. For example if the run the program that converts "New things to know" into hash and show the hash as output than the first result might show '$2b$12$/LHdmOpjLcK0cOI4KFIJees8YB0K7IJdkTreRQfLlAnSP1VUNgJma', another ''$2b$12$AeUG/6cJL8gepOTphLazBud/Os4tKdZVRrovGscn2qHMqLJhWW.kq".
In python the program is made like this. Code:
import bcrypt
phrase = b"New things to know"
hashed = bcrypt.hashpw(phrase, bcrypt.gensalt())
print(hashed.decode('utf-8'))
Just I want to tell is that it returns different hash for same phrase if it run many times.
Popular Posts
Changing text into voice using Javascript just in browser's console
- Get link
- X
- Other Apps
Comments
Post a Comment