Understand Hashing in Cryptography (A Practical Approach)

Cryptography is conversion of plain readable text into unreadable form. In cryptography first the data is converted into cipher text (that is encryption) and then the cipher text is converted back into readable form (that is decryption). Cryptography basically works on the concept of encryption and decryption. Encryption and decryption should not be confused with encoding and decoding, in which data is converted from one form to another but is not deliberately altered so as to conceal its content. Encryption is achieved through the algorithms. These algorithms are works with logic, mathematic calculations and its complexities.

Hash Function is most important function in Cryptography. A hash means a 1 to 1 relationship between data. This is a common data type in languages, although sometimes it’s called a dictionary. A hash algorithm is a way to take an input and always have the same output, otherwise known as a 1 to 1 function. An ideal hash function is when this same process always yields a unique output. So you can tell someone, here is a file, and here is its md5 hash. If the file has been corrupted during then the md5 hash will be a different value.

In practice, a hash function will always produce a value of the same size, for instance md5 () is will always return 128bits no matter the size of the input. This makes a 1 to 1 relationship impossible. A cryptographic hash function takes extra precautions in making it difficult to produce 2 different inputs with the same output, this is called a collision. It also makes it difficult to reverse the function. Hash functions are used for password storage because if an attacker where to obtain the password’s hash then it forces the attacker to break the hash before he can use it to login. To break hashes, attackers will take a word list or an English dictionary and find all of the corresponding hash values and then iterate though the list for each password looking for a match.

md5 (), sha0 and sha1 () are all vulnerable to a hash collision attacks and should never be used for anything security related. Instead any member of the sha-2 family, such as sha-256 should be used.

To calculate Hash Value, we will use Hash Calculator. Install Hash Calculator from –> http://www.slavasoft.com/hashcalc/

Hash function plays major role in hacking/forensic world because it helps us to know whether a particular file has changed or not. You can also calculate hash value of your computer and know if anyone has made any kind of changes.

To calculate hash value open Hash Calculator.

Now browse the file of which you want to calculate the hash value. And click on Calculate.

After clicking on calculate it will give too hash values using four different hashing algorithms i.e MD5, SHA1, RIPEMD160, CRC32. You can check other boxes too if you want to use those algorithms to calculate hash value.

This way Hash calculator helps us to know the hash value. Now if there are any changes made in this file, the hash value will change too.

Once I calculated the hash value above i made some changes in the file and calculated the hash value again with the same method and as a result the hash value was changed.

Now, we have two hash values. Let us compare both of these values of MD5. The value of first file is 1110808875326e25dl93e4ee096afaf1 and the value of other file is fb9d53883f302d78c978a583e8a85.

Seeing these two values of MD5 of the same file we can conclude that some changes are made. Because even slightest difference will change the hash value.

But now the main question is how to detect this change because a file can be of 1TB too. Also imagine that you are sending a harddisk full of important documents to someone and there is a huge possibility that someone can bribe the sender and make changes in your documents. So how can you detect these changes?

The answer is very simple –> Compare it! This tool helps us achieve our goal which is to detect the change.

Download Compare it! From —>http://www.grigsoft.com/wincmp3.htm

Open Compare it!

Click file and a drop menu will appear. Select compare files option.

A Dialogue box will open which will ask you to choose the files that you want to compare. Click on Browse button and select your file. And click on Open.

It will show you the changes by highlighting them with green color and the red color will tell the exact change as shown below:

So, in such way you can protect your sensitive data and detect the crime done too.

Author: Yashika Dhir is a passionate Researcher and Technical Writer at Hacking Articles. She is a hacking enthusiast. contact here

Beginner Guide of Cryptography (Part 1)

Cryptography is conversion of plain readable text into unreadable form. In cryptography first the data is coverted into cipher text (that is encryption) and then the cipher text is coverted back into readable form (that is decryption). Cryptography basically works on the concept of encryption and decryption. Encryption and decryption should not be confused with encoding and decoding, in which data is converted from one form to another but is not deliberately altered so as to conceal its content. Encryption is achieved through the algorythms. These algorythms are works with logic, mathematic calculations and its complexities.

Encryption : Encrypted data is refered to cipher text. Cipher text is conversion of readable text into undreadable form. It is the most effective way to achieve data security. To read an encrypted file, you must have access to a secret key or password that enables you to decrypt it. 

Decryption : Decryption is the process of converting encrypted data back into its original form, so it can be understood. To decrypt the data one needs a secret key or password so it can be decrypted.

Encryption can be done through three ways:

  1. Symmetric
  2. Asymmetric
  3. Hash

Symmetric :Symmetric encryption’s job is to take readable data, scramble it to make it unreadable, then unscramble it again when it’s needed. It’s generally fast, and there are lots of good encryption methods to choose from.  The most important thing to remember about symmetric encryption is that both sides—the encrypter, and the decrypter—need access to the same key.

Asymmetric :Asymmetric encryption also takes readable data, scrambles it, and unscrambles it again at the other end, but there’s a twist : a different key is used for each end.  Encrypters use a public key to scramble the data, and decrypters use the matching private (secret) key on the other end to unscramble it again.

Hash :Hashing is what is actually happening when you hear about passwords being “encrypted”.  Strictly speaking, hashing is not a form of encryption, though it does use cryptography.  Hashing takes data and creates a hash out of it, a string of data with three important properties : the same data will always produce the same hash, it’s impossible to reverse it back to the original data, given knowledge of only the hash, it’s infeasible to create another string of data that will create the same hash (called a “collision” in crypto parlance). hash is to authenticate otherwise clearly-transmitted data using a shared secret (effectively, a key.) The hash is generated from the data and this secret, so that only the data and the hash are visible; the shared secret is not transmitted and it thus becomes infeasible to modify either the data or the hash without such modification being detected.

Now, there are very simple methods to achieve cryptography in our day to day life so that our data sharing can be done securely.

For Symmetric encyption we can simply visit the website : www.aesencryption.net , shown below :

On this is website in first box writing your message and in second box give your password and then click on encrypt button on the right side.

The website will now reload itself and will provide you the encrypted text. Send this encrypted text to the desired person and tell them the key (which, in this case, is time).

The said person, after receiving your encrypted message, can come on this website to decrypt it. He/She will simple have to copy the encrypted text and paste it on the first box and enter the key in next box and click on decrypt button on the right side as shown below :

After clicking on decrypt the site will reload itself and will provide you with plain text.

Hence, symetric encryption.

For Asymmetric encryption, we can simply go to www.igolder.com/pgp/generate-key/ , the following website wil open

Click on generate PGP keys, after opening the website. A public and private key will be generated.

Now, copy the public key and click on PGP encrypt message option, it will redirect to the following page

Paste the public key in the first box and write your message in the second box. By clicking on Encrypt Message, you will get your message ecrypted.

Now, copy this encrypted message to the desired person along with the private key which you generated in the first step. The same person can also visited this site and click on PGP decrypt message option to decrypt the message. After clicking on the said option, the following page will open:

He/She can copy the private key and encrypted message and paste it on first and second box respectively.

At last click on Decrypt message and your message will be decrypted.

Author: Yashika Dhir is a passionate Researcher and Technical Writer at Hacking Articles. She is a hacking enthusiast. contact here

Encrypting File System (EFS) Tutorial for Beginners

Encrypting File System (EFS) is a feature of Windows that you can use to store information on your hard disk in an encrypted format. It uses sha1 algorithm for encryption/Decryption.

Encrypting a File

Suppose you want to encrypt a file Bank details. Right click on it and Select Properties then click on Advanced Settings.

Tick ‘Encrypt contents to secure data’ and Click ok. After That Click on Apply.

A dialog box will appear. Tick Encrypt the File only and Click OK to encrypt the File.

Now your file name font color will turn green which ensures File is encrypted successfully.

Now if you run this file on another system it will show an error Access is denied.

Decrypting a File

Now in order to decrypt that file on another system you need to create a certificate from the system by which you encrypted the file and then install that certificate on the system in which you want to run that file.

In order to create a certificate, go to file properties then advanced Attributes then details.

Click on Backup keys.

A dialog box will appear like this. Click on Next

Now Select “Include all certificates” and “Export all extended properties”. Click next.

Choose a password to protect your private key.

Select the path to which you want to store the key.

Click on Finish.

Now copy the certificate in the target system and execute it. A similar dialog Box will appear. Click on next until you see something like this. Enter the password you used before.

Click next and finish..Now the certificate is installed you can simply double click the file to open it

How to Hide Text behind Text

Introducing a very simple but very rarely known way of hiding a text file inside a text for transmission of secured textual information , thst to in few simple steps .

Hide

Step 1

Open command prompt and create a text file to where ever location you want or create a text file using windows GUI (in this example we have created our text file with name raj.txt and saved it to the Desktop). 

Step 2

Go to the location where the file has been saved and use “type” command to view the content of the file. 

Step 3

Here comes the main step of hiding secret information. A hidden / confidential file is now been created through Echo command and the confidential information is being saved in it.

Syntax: echo <Secret/confidential message> > host text file (raj.txt in our case) : <secret file name (secret.txt as shown below)>

We have saved our confidential file (secret.txt) containing confidential data within our host file (raj.txt)

 

Unhide

Step 4

To view the content of this hidden file, we need to use the following command after entering into the directory containing host file (raj.txt)

Syntax : start .<host file(raj.txt)> : <confidential file(secret.txt>

Related Posts Plugin for WordPress, Blogger...