def test29(): message = b'comment1=cooking%20MCs;userdata=foo;comment2=%20like%20a%20pound%20of%20bacon' print('message ' ,message) tag = dumbHashAuth(hash_secret, message) print('hash(secret||message) ',tag) newtag = appendMessage(message, tag, b';admin=true'); print("new tag = ", rawToHex(newtag))
def test29(): #这个message就相当于original data message = b'comment1=cooking%20MCs;userdata=foo;comment2=%20like%20a%20pound%20of%20bacon' #原始tag tag = dumbHashAuth(hash_secret, message) #新的tag运算,前面已经说过,最后的extra参数对应恶意加入的信息 newtag = appendMessage(message, tag, b';admin=true') print("new tag = ", newtag) print("Problem 29 success")
def checkDumbHashAuth(message, tag): return (dumbHashAuth(hash_secret, message) == tag)
def test29(): message = b'comment1=cooking%20MCs;userdata=foo;comment2=%20like%20a%20pound%20of%20bacon' tag = dumbHashAuth(hash_secret, message) newtag = appendMessage(message, tag, b';admin=true'); print("new tag = ", rawToHex(newtag)) print("Problem 29 success")