In this project you will use a cryptographic hashing method that allows a user to play a large video files block by block while making sure that the blocks are genuine without having to download the entire file first. [Cryptographic Hash Functions]
A. The server side: Preparing the video file
In a first step, this method will compute the hash value of given video file V as follows:
a) Select a secure hash function which is collision resistant like SHA256.
b) Break the file V into 1 Kbytes blocks ( 1024 bytes).
c) Divide the file V into consecutive blocks: B0 , B1, B2 , …., BN; if needed use padding for the last block ( add 0’s on the left).
d) Apply the following algorithm starting with the last block BN
i. Compute HN = SHA256(BN)
ii. For I = N-1 Down to 0 do
HI = SHA256(BI // H(I+1) );
iii. TAG(V) = H0
B. The user side: downloading and playing the video file. At this step, TAG(V) will represent that hash of file V. You will distribute TAG(V) through a secure channel to all your customers. When a customers would like to watch video file V; its browser will download the file one block at a time along with its associate hash value. The user will be able to view the video according the following process:
i. The browser request video file V.
ii. The browser downloads the first chunk of the video B0 along with H1 (B0 // H1 )
iii. The browser computes X = SHA256 (B0 // H1 );
iv. The browser checks if X = H0 .
v. IF yes the video chunk is displayed by the browser ; otherwise the browser stops the operation by displaying an error message.
vi. The browser requests the next chunk B1 along with H2 (B1 // H2 );
vii. The browser computes X = SHA256 (B1 // H2 );
viii. The browser checks if X = H1 .
ix. IF yes the video chunk is displayed by the browser ; otherwise the browser stops the operation by displaying an error message.
x. The browser requests the next chunk and so on. …………….
Your task is to use SHA256 as a hash function to compute TAG(V) as to verify every blocks of V as they are received. You may use Crypto++ (C++) library.¾
When appending the hash value to each block, append it as binary data, that is, as 32 unencoded bytes (which is 256 bits). If the file size is not a multiple of 1KB then the very last block will be shorter than 1KB, but all other blocks will be exactly 1KB.
You will apply application on two test files that you can upload from the Moodle site. For each file, you should:
Display TAG(V)¾
Verify the authenticity of each of its chunks as they are received.¾
The test files are named:
TESTFILE1.txt¾
TESTFILE2.txt¾
The MP4 files have been translated to Hexadecimal