Impossible, I'm afraid. Think about it, hashcode is a long value, i.e. 8 bytes. A string may be smaller than this, but it can also be much longer; you cannot compress a long string into 8 bytes without losing anything.
The hashcode Java algorithm sums every 8th byte, if I remember correctly that you lose 7 out of 8 bytes. If your lines are very short, you can encode them as int or long without losing anything.
source share