In an evolutionary/biological sense, mimicry is when two or more species resemble each other in appearance. There are two main types of mimicry:

Mullerian mimicry is when more than one species with similar defense mechinisms all have the same coloration. This is an effective strategy since a single pattern, shared among several species, is more easily learned by predators.

Batesian mimicry is when a species without any special defense mechanism mimics another species that predators avoid.

A good example of Mullerian mimicry is the way bees, yellow jackets and wasps all share yellow and black markings. A related example of Batesian mimicry are defenseless flies which have yellow and black markings.

In an information processing sense1, mimicry is often used to describe processes which generates something that attempt to "look like" another thing. "Looks like" can mean various things but commonly it refers to having the same profile, statistically.

For example, let's say I'd like to be able to generate a piece of text that has roughly the same letter frequency, word length, etc. as another piece of text. One way to do that would be to use what I'll call an N-th order mimicry function.

The algorithm for an N-th order mimicry function is given below.2

  1. Construct a list of every N-length combination of letters that appears in the source text and keep track of how frequently it appears.
  2. Choose a random entry from that list (which will be the first 5 letters of our mimic text.)
  3. To generate the next character of out mimic text, take the last N-1 characters of our existing mimic text. Search our list for every entry whos first N-1 characters match. Using a random number and the frequency information, choose one of those entries. Set the next character of the mimic text to the last letter of that entry.
  4. Repeat step 3 until you have enough text.

That's the general idea, right there. The larger the source text and the larger the value of N is, the better the mimic text looks. To give you an idea of what this looks like, I ran my fifth order mimicry function using Tanks: A Brief History and Hunting Guide as the source text. A sample of the output is below, followed by foot notes and finally, my very unpolished fifth order mimicry program, implemented in perl.

Fixed-wing any can't very support stop machines with articularly slow-technology to applique system, out of the tankbusting; the tanks and the A-10 can be as well at the A-10 can better weapons for to approach. The problem for killimeters, such as well. However, and the ammunits to applique system, massis. The probably to stone successary. The pressions and the A-10 Thundred yards, howeveral part direct curity tanks armor became only base, most not to work of the tanks are they're cheap, shapes of they military. They miles of the ammunits the tanks are your minimum or reactics...' and mored to work of they military. The problem with artillery, but he number of the tanks are areasily, and the tank, the aims have claimed for killing a bunkers, and lethal objective are your minimum or the tanks will as well at the aircraft is hits limited with artillery, became of they are the to stop and the A-10 Thundred to applique system, mass or the A-10 Thundred to applique system, outsides - the tankbusting. Althout of the tank, which the tanks are the tank, they miles of the tank, immobility to stop of the tasks. He doesn't very good and to approach. The posses will at the aircraft is the ammunits that many schools, the aircraft is times your mines and mored to stop of the tank, the A-10 can be only infantry and mored to stop and lethal' and the A-10 can wheels are you just the tanks. He does it, they milities, means that the ammunits today are you don't very good partillery is that the ammunits to approach. The problem as well out of the tanks and they also hit to approach. They also footing the tanks. He doesn't verify the tanks and lethal objective possessed for they also hits, perhaps the A-10 can which the aircraft: In infantry - that the tanks armored to applique system, out of they are the tanks via Tornado's a result, to stop and the A-10 can better wall your mines and the tanks with the tanks with armor, etc. They milling and like to applique system, massive articularly to applique system, mass or the tanks are the tanks are the A-10 can be only base, the ammunits to applique system, mass Agains, however, and the two typically made it the tanks are are are they're children of the tasks. The problem for the tanks will spreads, howevertheless. By they also hit by team, which can wheels are areasily, the tank, the tank, the A-10 Thundred to applique system, out of the A-10 can't very support stone best of the tanks are areasily, they're cheap, shaped chargets and to approach. The pressions. At the A-10 can better aircraft is hit to applique system, out in the tanks aren't very good and the

1. What I'm describing here comes from Disappearing Cryptography by Peter Wayner. However, this example and the text below are not actually steganography, in spite of the fact that the ideas and code below could be developed further into a steganographic application. So, I'll say "information processing" rather than "information hiding."
2. Once again, this is rephrased from Disappering Cryptograph. Their description is much better than mine.

#Your generic white-bread text mimicer. This is a very rough
#draft, so the implementation is not at all efficient. Or friendly.
#In fact, the input text is hard coded.
#If you improve this or fix any bugs, I'd love it if you'd
#drop me a message letting me know, and email me the diffs
undef %sequence_hash;
undef @text_array;
#Change this to whatever file you want to use as text to mimic.
$IN_FILE = "text";
open IN_FILE or die "Failed to open file.\n";
#Force STDOUT to be flushed after every write. It's slower but you
#get to see the results as they happen. It should function perfectly
#fine without this.
$| = 1;
#Yes. This next section is exactly as stupid as it looks.
while(read(IN_FILE, $buf, 1))
{       push @text_array, $buf;
for($c = 0; $c < $#text_array - 5; $c++)
{       my $tmp = $text_array[$c + 0] . $text_array[$c + 1] . $text_array[$c + 2] .
                $text_array[$c + 3] . $text_array[$c + 4];
        if(defined $sequence_hash{$tmp})
        {       $sequence_hash{$tmp} = $sequence_hash{$tmp} + 1;
        } else
        {       $sequence_hash{$tmp} = 1;
#This next bit sets up a random staring point to mimic from.
#Right now it's random, but it might be nice if we
#started with a capital letter. *shrug*
@keys = keys %sequence_hash;
$current = rand_current( \@keys);
print $current;
#And here we are at the main little bit.
#If you want this to generate forever, just do while(1) here.
for($c = 0; $c <5000; $c++)
        #Take off the first character
        $current =~ s/^.(....)/$1/s;
        undef %possible;
        #Now, for every key in that huge fucking hash table...
        foreach $i (keys %sequence_hash)
        {       #Do a little substitution to keep characters in
                #the text from fucking up the regex to follow.
                $current =~ s/\./\\./g;
                $current =~ s/\(/\\(/g;
                $current =~ s/\)/\\)/g;
                $current =~ s/\?/\\?/g;
                #If the first 4 characters of the key match
                #the last 4 characters we printed...
                if( $i =~ m/^$current/)
                {       #make an entry in the possibility hash
                        $possible{$i} = $sequence_hash{$i};
                #Now, put current back to the way it was.
                $current =~ s/\\//g;
        #Get the next character
        $next = get_next(\%possible);
        #Append it to current.
        $current = $current . $next;
        #print the character
        print $next;
        #Let's do it again, shall we?
#When we're done, lets make a newline, shall we?
print "\n";

sub get_next
#Takes a reference to all of the possible keys
#Returns a character.
{       my $hashy_ref = shift;
        my $total = 0;
        @the_keys = keys %$hashy_ref;
        @the_keys = sort {$a cmp $b} @the_keys;
        #Figure out the scale for the random number.
        foreach $foo (@the_keys)
        {       $total = $total + $$hashy_ref{$foo};
        #get a random from 0 to 1
        my $random = rand;
        #Ok, this next bit is going to look brain damaged.
        #It might help you understand why I did it this way if
        #you keep in mind that eventually I'd like to use
        #this program in conjunction with arithmetic coding.
        foreach $foo (keys %$hashy_ref)
        {       if( ($$hashy_ref{$foo} / $total) >= $random)
                        $foo =~ s/.*(.)$/$1/s;
                        return $foo;
                } else
                {       $random -= $$hashy{$foo} / $total;
        #It should never, ever get here.
        return $foo;

sub rand_current
#Takes a reference to an array containing the keys
#for our fat-ass hash and returns one of them at
#random. Pretty straight forward.
{       my $array_ref = shift;
        my $array_size = $#$array_ref;
        my $position = rand $array_size;
        return $$array_ref[$position];


Mim"ic*ry (?), n.


The act or practice of one who mimics; ludicrous imitation for sport or ridicule.

2. Biol.

Protective resemblance; the resemblance which certain animals and plants exhibit to other animals and plants or to the natural objects among which they live, -- a characteristic which serves as their chief means of protection against enemies; imitation; mimesis; mimetism.


© Webster 1913.

Log in or register to write something here or to contact authors.