19

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?

F21
  • 32,163
  • 26
  • 99
  • 170
  • 6
    More than personal taste, this actually may have legal implications in some countries (Germany, France) where the depiction of the symbol outside a historic context is forbidden. I’m not sure if this has ever been challenged in court but why try? – Konrad Rudolph Jul 23 '12 at 10:48
  • @KonradRudolph: Agreed. That's why I would like to prevent these symbols from generated :) – F21 Jul 23 '12 at 10:50
  • 2
    https://addons.mozilla.org/en-us/firefox/files/browse/77910/file/chrome/identfavicon.jar/content/identfavicon.js#L118 is in .js, but does hint at a method - avoiding certain combinations of sprites. – DaveP Jul 23 '12 at 11:14

3 Answers3

9

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.

ecatmur
  • 152,476
  • 27
  • 293
  • 366
  • I like the unicorns, but due to the nature of the application, some abstract shapes (that are not swastikas!) would be more suitable. Don Park's comment is interesting, but I am hoping there's a simple adjustment to the algorithm that would not require OCR and image analysis. – F21 Jul 23 '12 at 11:11
9

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.

Steve Jessop
  • 273,490
  • 39
  • 460
  • 699
0

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.

Don Park
  • 379
  • 1
  • 5
  • 3