Channels ▼


Visual Cryptography and Bit-Plane Complexity Segmentation

Source Code Accompanies This Article. Download It Now.

Daniel is a senior programmer for the Aareal Bank in Germany, and a doctoral student in applied cryptography at the Military Technical Academy in Romania. He can be contacted at

Steganography is defined as "the art and science of writing hidden messages such that no one apart from the intended recipient knows of the existence of the message" ( In implementing steganography applications, you can embed information in both the image domain itself and in one of the image's transformed domains—frequency, cosine, or wavelet. In this article, I describe a steganography technique based on Bit-Plane Complexity Segmentation (BPCS) and visual cryptography. To test its viability, I implemented the technique in Python.

Bit-Plane Complexity Segmentation, a lossy image-compression technique first proposed at the Kyushu Institute of Technology, lets you embed large amounts of data in images. But to do so, you need visual cryptography to decompose a message in two shares with a highly random character.

Generally, visual cryptography is considered a visual form of secret sharing; see Doug Stinson's article "Visual Cryptography and Threshold Schemes" ( and my article "Extended Visual Cryptography Schemes" ( In its simplest form, a (2,2) visual cryptography scheme "splits" the original image into two "shadow images" called "shares." Every pixel in the original image is expanded to a 2x2 pixel matrix with a different version in any of the two shares. Any share contains uniformly distributed random black-and-white pixels. By analyzing only a single share, you can't obtain information about the original image, no matter how much computing power or analysis method is used. The whole point of visual cryptography is that in the decryption process, the original image has to be visually reconstructed. Each share is printed on a separate transparency and passed to a participant at the scheme. When the two participants come together, the secret can simply (and theoretically instantaneously) be reconstructed by stacking the two transparencies.

To build the shares, the visual cryptography scheme my application uses only considers diagonal matrices—see Versions 1 and 2 in Table 1. Figure 1 is an example of the visual cryptography scheme implemented by the application.

[Click image to view at full size]

Figure 1: (a) Secret message; (b) recomposed message; (c) first share; (d) second share.

[Click image to view at full size]

Table 1: A (2,2) visual cryptography scheme.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.