Solution: a is the most significant byte in a 8k bit number and b is the list significant byte. Thus: w2 = (w1 a*28(k-1))*28+b – w2 mod m = ((w1 a*28(k-1))*2^8+b) mod m = (w1*28 a*28k +b) mod m – – = ((w1 mod m)* (28 mod m) (a mod m)*(28k mod m) + b mod m) mod m – = X * (28 mod m) (a mod m)*(28k mod m) + b mod m) mod m – Note that X is known from the last window, a,b and 28 are small numbers easy to calculate mod and – 28k mod m can be calculated once in the beginning and saved. Question 6 You have a large amount of data chunks that need to be stored in servers in the cloud. In order to for the data to be distributed evenly, each data chunked is hashed to decide what server it will be stored in. In case a server stops working, its data chunks are supposed to be distributed evenly among the remaining servers. The data chunks of the remaining server obviously need to continue being stored in their server. If we implement such a system by numbering the servers and using modulo the number of servers as hash function, we will have a problem when a server stops working and the number of server changes, all the hash values will change. Suggest a way to implement such a system.
Solution: a is the most significant byte in a 8k bit number and b is the list significant byte. Thus: w2 = (w1 – a*28(k-1))*28+b w2 mod m = ((w1 – a*28(k-1))*2^8+b) mod m = (w1*28 – a*28k +b) mod m = ((w1 mod m)* (28 mod m) – (a mod m)*(28k mod m) + b mod m) mod m = X * (28 mod m) – (a mod m)*(28k mod m) + b mod m) mod m Note that X is known from the last window, a,b and 28 are small numbers – easy to calculate mod and 28k mod m can be calculated once in the beginning and saved. Question 6 You have a large amount of data chunks that need to be stored in servers in the cloud. In order to for the data to be distributed evenly, each data chunked is hashed to decide what server it will be stored in. In case a server stops working, its data chunks are supposed to be distributed evenly among the remaining servers. The data chunks of the remaining server obviously need to continue being stored in their server. If we implement such a system by numbering the servers and using modulo the number of servers as hash function, we will have a problem when a server stops working and the number of server changes, all the hash values will change. Suggest a way to implement such a system.