Implement the Rumba cryptographic hash according to the following description: L
ID: 3602932 • Letter: I
Question
Implement the Rumba cryptographic hash according to the following description:
Let X be the data you wish to hash after 10* padding to a multiple of 128 bytes
Let X_1, X_2, ..., X_n be X broken into 128-byte chunks
chain = 64 bytes of zero
for i = 1 to n {
chain = compression(concat(chain,X_i))
}
return first 32 bytes of chain
where compression follows the following algorithm:
Let M_1, M_2, M_3, M_4 be the input broken into 48-byte chunks
return chacha20_block(concat("firstRumba20bloc",M_1)) xor
chacha20_block(concat("secondRumba20blo",M_2)) xor
chacha20_block(concat("thirdRumba20bloc",M_3)) xor
chacha20_block(concat("fourthRumba20blo",M_4))
Write a C function with the following header:
void rumba(unsigned char out[32], unsigned char in[], int n)
It should perform the above algorithms on the n bytes found at in and write the output of the hash at out.
I already have the chacha20_block code.
Explanation / Answer
import cv2 import numpy as np from matplotlib import pyplot as plt #roi is the object or region of object we need to find roi = cv2.imread('rose_red.png') hsv = cv2.cvtColor(roi,cv2.COLOR_BGR2HSV) #target is the image we search in target = cv2.imread('rose.png') hsvt = cv2.cvtColor(target,cv2.COLOR_BGR2HSV) # Find the histograms using calcHist. Can be done with np.histogram2d also M = cv2.calcHist([hsv],[0, 1], None, [180, 256], [0, 180, 0, 256] ) I = cv2.calcHist([hsvt],[0, 1], None, [180, 256], [0, 180, 0, 256] )