Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

II AT&T; 11:01 AM lincoln.mrooms.net How does a hashing algorithm work? Descript

ID: 3733672 • Letter: I

Question

II AT&T; 11:01 AM lincoln.mrooms.net How does a hashing algorithm work? Description: You are required to work on this project individually not in a group. You should work on this project outside of the class time Objectives Secure Hash Algorithm: is a cryptographic hash function designed by the United States National Security Agency and is a U.S. Federal Information Processing Standard published by the United States. Research Write C++ Program showing how it works How do one-way hash functions work? Research various methods security could be used on haslh functions and write a report on it. List the different methods you identified in your search. Project Deliverables o Projects reports are expected to be 2 pages long. Don't stretch the report just to meet a particular page number, nor feel constrained if it needs to be longer to get your key points and results across. o A good report must answer the standard questions about any research project. Prepare a class PowerPoint Presentation and DEMO (50% of your grade is based on successful DEMO with documentation) It needs to be submitted in Moodle on due date before the class otherwise it will not be graded. NO LATE WORK ACCEPTED. Be prepared to present it during the class. REQUIREMENTS - Any project received after the time of the class is considered late (NO EXCUSES) and is graded with 30% off for each class it is late.

Explanation / Answer

#include<stdio.h>
#include<string.h>
#include<math.h>
#define left(x,n) ((x<<n) | (x>>(32-n)))
#define right(x,n) ((x>>n) | (x<<(32-n)))
void SHA(char * s)
{
unsigned long int hash0,hash1,hash2,hash3,hash4,p,q,r,s,t,f,k,temp;
hash0 = 0x67452301;
hash1 = 0xEFCDAB89;
hash2 = 0x98BADCFE;
hash3 = 0x10325476;
hash4 = 0xC3D2E1F0;
unsigned char * s;
int i;
s = (unsigned char *)malloc(strlen((const char *)s1)+1000);
strcpy((char *)s,(char *)s1);
int l1 = strlen((char *)str);
int l2 = l1;
s[l1] = 0x80;
s[l2] = '';
char x = s[l1];l1++;
int y = l1 % 64;
if(y<56)
y = 56-y;
else
y = 120 - y;
for(i=0;i < y;i++)
{
s[l1]=0x00;
l1++;
}
s[l1 + 1]='';
for(i=0;i<6;i++)
{
s[l1]=0x0;
l1++;
}
s[l1] = (l2 * 8) / 0x100 ;
l1++;
s[l1] = (l2 * 8) % 0x100;
l1++;
s[l1+i]='';
int count = l1/64;
unsigned long int z[80];
for(i=0;i<count;i++)
{
for(int j=0;j<16;j++)
{
z[j] = s[i*64 + j*4 + 0] * 0x1000000 + s[i*64 + j*4 + 1] * 0x10000 + s[i*64 + j*4 + 2] * 0x100 +s[i*64 + j*4 + 3];
}
for(j=16;j<80;j++)
{
z[j] = left((z[j-3] ^ z[j-8] ^ z[j-14] ^z[j-16]),1);
}
p = hash0;
q = hash1;
r = hash2;
s = hash3;
t = hash4;
for(int j=0;j<80;j++)
{
if(j<=19)
{
f = (q & r) | ((~q) & s);
k = 0x5A827999;
}
else if(j<=39)
{
f = q ^ r ^ s;
k = 0x6ED9EBA1;
}
else if(j<=59)
{
f = (q & r) | (q & s) | (r & s);
k = 0x8F1BBCDC;
}
else
{
f = q ^ r ^ s;
k = 0xCA62C1D6;
}
temp = (left(p,5) + f + t + k + z[j]) & 0xFFFFFFFF;
t = s;
s = r;
r = left(q,30);
q = p;
p = temp;
}
hash0 = hash0 + p;
hash1 = hash1 + q;
hash2 = hash2 + r;
hash3 = hash3 + s;
hash4 = hash4 + t;
}
printf("Calculated hash is : %x %x %x %x %x ",hash0, hash1, hash2, hash3, hash4);
}
void main()
{
char *s;
scanf("%s",s);
SHA(s);
}

2. the one way hash functions are basically designed to enhance authenticity and confidentiality of the underlying system. In these hash functions, once the hash value from an given dataset is calculated, one can not trace back the original dataset. Thus, this enhances the confidentiality of the system. examples: passwords in facebook is tored as hash value at their servers. therefore, whenever a you lose a password and ask for it's retrieval,you are given a link to create a new password. The existing password is not retained.

But these one way hash functions are now being easily broken.

3. Different methods to provide security to data are:

Data Masking

Data back up

Notorising

Digital signature

Third party authentication

Certification authority,etc