Image authentication using generalised finite automata