# How to plot the distribution of a ciphertext?

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

-
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