For each buffer, you could rotate it until it has the minimum lexicographical value.
For example, your example buffers could be rotated like this:
AAABCCCA -> AAAABCCC
AABCCBAA -> AAAABCCB
AAAACCAA -> AAAAAACC
This basically means putting the lowest-valued item first. If there is a tie, compare the next items, etc. This gives a unique ordering for any pattern.