Finding a pair of words from two files with a particular MD5
In general, no, this would not be the fastest approach. However, assuming that all the lines are quite small, I think you won't do better by the 'general' fast approach.

You could use hashlib.md5().copy().

import hashlib
with open('1.txt') as f:
    a= [line.rstrip() for line in f]
with open('2.txt') as f:
    b= [line.rstrip() for line in f]

for y in a:
    prefix_hash = hashlib.md5(y)
    for z in b:
        if prefix_hash.copy().update(z).hexdigest() == 'XXXTHEXXXHASHXXX':
            print y + z
            break


Again, assuming len(y) is not that large, this is unlikely to do any better, and might even do worse because of the .copy() now used. But you're welcome to benchmark it.