The Following Describes The Simple Hash Functionchoose P Q Primes An The following describes the simple hash function: Choose p, q primes and compute N = pq. Choose g relatively prime to N and less than N. Then a number n is hashed as follows: H = g^n mod N. If there is an m that hashes to the same value as n, then g^m ≡ g^n mod N, which implies g^{m-n} ≡ 1 mod N, so m – n ≡ 0 mod φ(N). Breaking this involves finding a multiple of φ(N), which is the hard problem in RSA. Write a function that takes a bit length n and generates a modulus N of bitlength n and g less than N and relatively prime to it. Show the output of your function from part (a) for a few outputs. Using N, g, n as arguments, write a function to perform the hashing. For the following parts (a)-(d), compute the simple hash: N = 600107, g = 154835, n = 239715; N = , g = , n = ; N = , g = , n = . Write a function that creates a collision given p and q. Show that your function works for a couple of examples.
Paper For Above instruction The simple hash function described involves modular exponentiation based on selecting prime numbers p and q to produce a composite modulus N, and choosing a base g that is relatively prime to N. This approach is reminiscent of the RSA cryptosystem's mathematical framework, relying on the difficulty of factoring N to secure cryptographic operations. The core idea is to hash a number n by computing g^n mod N, and the goal is to generate colliding inputs—distinct numbers n and m that result in the same hash value—by exploiting properties of modular arithmetic. To implement this, the first task is to develop a function that, given a desired bit length n, generates two prime numbers p and q with approximately n/2 bits each, computes their product N, and selects a suitable g less than N that is coprime to N. Ensuring that g is coprime to N is critical, as it guarantees that g has a multiplicative inverse modulo N, which ensures the security and functionality of the hashing operation. The output should include several examples demonstrating how different generated N and g pairs behave during hashing operations. Next, the core hashing operation involves calculating g^n mod N for an input n. This function should be efficient and capable of handling large exponentiations. Using given samples, such as N=600107, g=154835, and n=239715, the hash function computes the hash value by performing modular exponentiation. Repeating this for other values of N, g, and n demonstrates the consistency and behavior of