Pergunta

I am using this PHP script to generate identicons. It uses Don Park's original identicon algorithm.

The script works great and I have adapted it to my own application to generate identicons. The problem is that sometimes swastikas are generated. While swastikas have peaceful origins, people do take offence when seeing those symbols.

What I would like to do is to alter the algorithm so that swastikas are never generated. I have done a bit of digging and found this thread on Microsoft's website where an employee states that they have added a tweak to prevent generation of swastikas, but nothing more.

Has anyone identified what the tweak would be and how to prevent swastikas from being generated?

Foi útil?

Solução

Identicons appear to me (on a quick glance) always to have four-fold rotational symmetry. Swastikas certainly do. How about just repeating the quarter-block in a different way? If you take a quarter-block that would produce a swastika in the current pattern, and reflect two diagonally-opposite quarters, then you get a sort of space invader.

Basically, nothing with reflectional symmetry can look very much like a swastika. I suppose if there's a small swastika entirely contained within the quarter, then you still have a problem.

Outras dicas

On Jeff Atwood's introducing thread, Don Park suggested:

Re Swastika comments, that can be addressed by applying a specialized OCR-like visual analysis to identify all offending codes then crunch them into an effective bloom filter using genetic algorithm. When the filter returns true, a second type of identicon (i.e. 4-block quilt) can be used.

Alternatively, you could avoid the issue entirely by replacing identicons with unicorns.

My original suggestion involving visual analysis was in context of the particular algorithm in use, namely 9-block quilt.

If you want to try another algorithm without Swastika problem, try introducing symmetry like one seen in inkblots to popular 16-block quilt Identicons.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top