in reply to Suffix-prefix matching done right

Please provide a real test case!

Randomly chosen base64 strings will almost never overlap. And comparing the efficiency of different solutions is not possible with the fuzzy specs given.

So efficiency will also depend on the nature of the real data.

My suggestions:

But you don't need to try all possible length, because only a small number of positions are likely:

This should be far more efficient than your code.

updates

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

°) euphemism for buggy

edit
added none