Project 12x: SHA-3 on Kali Linux (15 pts.)

What You Need

Purpose

SHA-3 is here, but it's not yet available in tools like Hashcalc and Filealyzer.

I just wanted to try it out now. At present, there is no real practical purpose, but it's a bit of practice with git and python.

Installing Python Components

In Linux, in a Terminal window, execute these commands:
apt-get update

apt-get install python-dev -y

When a screen appears asking whether to restart services without asking, answer Yes.

Using git

git is a great way to distribute files for projects under development.

We will make a directory to use, clone the files and folders with git, and make the python extension module for sha-3, which includes these four classes:

- sha3.sha224 - SHA-3 224 bits
- sha3.sha256 - SHA-3 256 bits
- sha3.sha384 - SHA-3 384 bits
- sha3.sha512 - SHA-3 512 bits

In Linux, in a Terminal window, execute these commands:

apt-get install python-dev
cd
mkdir sha3
cd sha3
git clone https://github.com/ajakubek/python-sha3.git
cd python-sha3
python setup.py build
python setup.py install

Troubleshooting

In May, 2014, a student could not perform the git clone because it asked for a password. The only solution we could find was to use a different machine.

If the "python setup.py build" fails, you may be missing some dependencies. This happened to a student who was using BT5 R1. To fix it, execute this command:

apt-get update
  

apt-get install python-crypto python-dev -y

Using the Modules in Python

In Linux, in a Terminal window, execute these commands:
python
from sha3 import sha256
s=sha256()
s.update("")
s.hexdigest()
This calculates the SHA-3 256 bit hash of an empty string, as shown below:

But how can we know that is correct?

Here's the hash of an empty string, provided as a test case by the developers of SHA-3, from http://keccak.noekeon.org/files.html:

As you can see, the value is correct, starting with "c5d2"--it is working correctly!

Calculating the Hash of "abcd"

In Linux, in a Terminal window, at the interactive Python prompt >>>, execute these commands:
s=sha256()
s.update("abcd")
s.hexdigest()
The result starts with "48bed", as shown below:

Saving the Screen Image

Make sure the hash value starts with "48bed", as shown above.

Save a screen capture with a filename of "Proj 12xa from YOUR NAME".

Verifying the Hash Accuracy

The hash for "abcd" is included in the file "test.py" included in the git repository we cloned, as shown below:

As you can see, the string "abcd" hashes to a hash starting with "48bed", as expected.

The SHA-3 code is working.

Calculating the SHA-3 256-bit hash of "apple"

Using the procedure above, calculate the 256-bit hash of "apple". The correct answer starts with "85dca".

To get credit you must send in the entire hash value--we'll check the end of it for accuracy. Save that as image "Proj 12xb from YOUR NAME"

Calculating the SHA-3 512-bit hash of "CCSF"

Using the procedure above, calculate the 512-bit hash of "CCSF". The correct answer starts with "85f1".

To get credit you must send in the entire hash value--we'll check the end of it for accuracy. Save that as image "Proj 12xc from YOUR NAME"

Turning In Your Project

Email the images to cnit.120@gmail.com with a subject of "Project 12x from YOUR NAME".


Sources

https://github.com/ajakubek/python-sha3

http://learn.github.com/p/setup.html

http://stackoverflow.com/questions/12716204/have-keccak-sha-3-example-hashes-test-vectors-been-made-available

http://keccak.noekeon.org/files.html


Last modified: 12-9-14 12:24 pm