A method for compressing and decompressing files is provided. The method includes creating a list of shift-invariant focal points of neighborhoods in the stream and comparing those focal points to a list of focal points created using the same method on the reference stream. The method of the present invention searches for the longest sequence of focal points that appear in both files. The method of the present invention also verifies that neighborhoods contain the same focal points. The changed data and references to the reference stream are then encoded. The decompression process decodes the encoded stream of data, and using the reference stream recreates the new version of stream.