Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any plot or visualizing program that can plot the distribution of a plaintext and then the distribution of the ciphertext after applying a ciphering encryption algorithm? I am interested from stream ciphers

share|improve this question
This is very general - by "distribution" what do you mean? I suspect you mean the relative frequency of bytes before and after encryption? If bytes, there is a nice hex editor (HxD Editor) which can produce a histogram of the frequency of each byte (from 0 to 255) in a given binary file. If you already have the distribution, you could use any spreadsheet software like OpenOffice, Excel, etc... could you add more detail? – Thomas Sep 21 '12 at 9:03
Yes you are right. What i was thinking is that lets say that each byte or bytes or stream of bytes in the plaintext is plotted in a two dimensions or more graph. And then after encryption , i want to see the bytes in the same plot and how far they are with the plaintext. Does this make sense or it's very naive? – curious Sep 21 '12 at 9:15
Well, against a strong stream cipher you would see no correlation, but it is an interesting exercise against mediocre ciphers (like a stream cipher based on an LCG or character shift). You can plot a multidimensional graph but in my experience 2 dimensions is best - any higher and it get difficult to visualize it. I think if you are not looking for complex relationships, a good spreadsheet can do that for you: make two columns with your plaintext and ciphertext bytes, process them into a third column as required, graph any two (or a single) columns and look for patterns - reiterate etc... – Thomas Sep 21 '12 at 9:39
If you're using python, I'd recommend using matplotlib's pcolor function to display a colored 2D matrix showing the values in the digraph (dibyte) histogram/distribution. – Harel Sep 21 '12 at 11:44
up vote 2 down vote accepted

What you are looking for is a histogram plot.

For example, the distribution of letters in the english language looks like this:

Histogram of English Text

The plot of a ciphertext from a strong cipher should have all bars about the same height (a fairly uniform distribution).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.