I was trying to write a code for a Subtitle finder in Java using SubDB api. Since I don't know python much, I don't understand what they are doing to calculate the hash value for a string. The hash is composed by taking the first and the last 64kb of the video file, putting all together and generating a md5 of the resulting data. name is the filename.
def get_hash(name):
readsize = 64 * 1024
with open(name, 'rb') as f:
size = os.path.getsize(name)
data = f.read(readsize)
f.seek(-readsize, os.SEEK_END)
data += f.read(readsize)
return hashlib.md5(data).hexdigest()
Can anyone help me with the implementation of above code in Java?