Using C write a function that creates a 32bit hash file Plea
Using C++ write a function that creates a 32-bit hash file. Please represent the 32 bits in hexadecimal.
-read the txt from the users keyboard
-Set the hash to all ones
-In a circular manner shift the bit pattern in the hash to the right 6 positions.
-XOR the new byte read from the file with the most significant byte (the leftmost) of the hash.
-print the hash on the screen
Solution
Hello I can\'t understand your question clearly
I made answer as per my understanding
//Set Hash to all 1\'s
unsigned int hash = 0xffff;
//In a circular manner shift the bit pattern in the hash to the right 6 positions
hash = hash >>6;
//read the txt from the users keyboard
string mystr;
cout << \"Enter Some Text \";
getline (cin, mystr);
unsigned int haskKey = 0;
/**
* Calculte Hash for given String
* XOR the new byte read from the file with the most significant byte (the leftmost) of the hash.
* */
for(char& c : mystr) {
haskKey += (hash >>24)^c;
}
//Print Hash key
cout << \"Hash Key is %d\" << haskKey;
