Question: The hash _ text function will consume a string ( any kind of message ) and two integers ( base and hash _ size )

The hash_text function will consume a string (any kind of message) and two integers (base and hash_size), and produces an integer that attempts to uniquely represent the text.
Convert the string to a list of integers using ord.
Transform each integer of the list using the following formula: new value =(index + base)**(old value). Hint: to get the index, you can use the Count pattern or the built-in enumerate function.
Sum the list of integers.
Use the modulo operator (%) to limit the total value to hash_size.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!