Suppose you would like to build a hash table for images wher
Suppose you would like to build a hash table for images, where the key for each image is a“thumbnail”image of 75×75 pixels,with each pixel being one of 256 possible colors. Describe a hash function for a set of such images. Your hash function should be fast to compute and it should strive to map different images to different hash values. In particular, re?ections and 90? rotations of the same image should, in general, map to different hash values.
Solution
The hash function is as follows:
import java.nio.*;
import java.security.MessageDigest;
import java.net.*;
public class Test
{
public static void hash_method()
{
//create an array of type int
int[] data;
//Allocate the memory space to x.
ByteBuffer x = ByteBuffer.allocate(data.length*4);
//Create intBuffer of type IntBuffer.
IntBuffer intBuffer = x.asIntBuffer();
//Store the data in intBuffer.
intBuffer.put(data);
//Create an array of type byte and store it in intBuffer.
byte[] array = x.array();
//Create a variable y of MessageDigest.
MessageDigest y = MessageDigest.getInstance(\"SHA-256\");
//Create hash.
byte[] hash = y.digest(data);
}
}
class Test_main
{
public static void main (String [] args) throws Exception
{
//call the hash_method
Test.hash_method();
}
}
In the hash function, it is required to map the 75*75 pixel colors.

