Question: with Linux : They are using MAC(K,M) = K & H(M), where the key is 160-bits, H is the SHA-1 hash function, and & indicates

with Linux :

They are using MAC(K,M) = K & H(M), where the key is 160-bits, H is the SHA-1 hash function, and & indicates bitwise-AND. Your job is to find the valid MAC tag for a new message "I hate you" (with no newline and no quotes). For your answer, you should enter the HEX of the correct tag for this message, and give the key.

Messages you've seen:

I am so happy!

where should we go this weekend

we should go out tonight

you are the best

I like you

I got you flowers

Matching tags (by line) :

68010c9610d0b0301b41a0f004d0608400684210 3815549e30000a30164000920c82404224284898 e9510c0620d542108d7080a005d068c22c480698 41405496601421301c01019008123046200a0e8a b01044123084a00093200070148030800c004688 8145188b60914a100c3120d21c90180420404a08

Hash function theyre using in Linux to encrypt :

File: badmac.py

#!/usr/bin/python

import sys import hashlib

# this is NOT the key Alice and Bob are using key = 'a'*20

# read from standard input msg = sys.stdin.readlines()[0] hashed = hashlib.sha1(msg).digest()

#tag = '' #for i in range(len(hashed)): # tag += chr(ord(key[i])&ord(hashed[i])) tag = ''.join([chr(ord(key[i])&ord(hashed[i])) for i in range(len(hashed))]) print tag.encode('hex')

To find the Key, remember how bitwise AND works with binary.

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 Databases Questions!