# Mimic function

A mimic function changes a file ${\displaystyle A}$ so it assumes the statistical properties of another file ${\displaystyle B}$. That is, if ${\displaystyle p(t,A)}$ is the probability of some substring ${\displaystyle t}$ occurring in ${\displaystyle A}$, then a mimic function ${\displaystyle f}$, recodes ${\displaystyle A}$ so that ${\displaystyle p(t,f(A))}$ approximates ${\displaystyle p(t,B)}$ for all strings ${\displaystyle t}$ of length less than some ${\displaystyle n}$. It is commonly considered to be one of the basic techniques for hiding information, often called steganography.
The simplest mimic functions use simple statistical models to pick the symbols in the output. If the statistical model says that item ${\displaystyle x}$ occurs with probability ${\displaystyle p(x,A)}$ and item ${\displaystyle y}$ occurs with probability ${\displaystyle p(y,A)}$, then a random number is used to choose between outputting ${\displaystyle x}$ or ${\displaystyle y}$ with probability ${\displaystyle p(x,A)}$ or ${\displaystyle p(y,A)}$ respectively.
More sophisticated mimic functions use grammar-based models of ${\displaystyle B}$ to structure the output. One example, "SpamMimic", uses a context free grammar to model the structure of a typical spam email message. It will convert the input file A to read like a spam message.