Welcome!

Welcome to Dr. B's Science Lab, a non-commercial resource for up-to-date and accurate science content, activities, and projects. Explore a different topic every month, and get the whole family involved in learning and experimenting! Just be sure to follow the directions exactly and pay attention to any safety information given.

If you would like to receive email updates whenever new content is added to Dr. B's Science Lab, submit your address in the "Follow by Email" link at left. Your email address will not be used for any other purpose.



Showing posts with label codes. Show all posts
Showing posts with label codes. Show all posts

Thursday, October 27, 2011

Hide and Seek!

Here's an example of a code that hides within another message. It's called a Cardan grille. Read the message below. Does it seem strange? No, it's just a note from one person to another, making plans to go to the zoo.


Aahh, but there is a secret message hidden within all of those words! It can be read with a stencil, or grille, with cutouts that reveal only some of the letters. The grille is placed over the original message, and the hidden words suddenly appear. Here is the grille for this message (the black areas are the cutouts):



OK, so maybe that's not very helpful by itself. But if we place the grille over the original message, the mystery is solved:

How about that?

The Cardan grille is a very old type of code, invented by Girolamo Cardano in 1550. It is an example of steganography, which means "concealed writing". Unlike many other codes, no one would even suspect that the original message held a secret meaning. The problem with the Cardan grille is that both the sender and the receiver must have identical copies of the grille. Also, it can be hard to construct a natural-sounding message around the necessary letters.

Try making some Cardan grilles yourself. You might want to start with hiding just a few words, rather than a whole sentence.

Wednesday, October 19, 2011

Modern Secret Codes

The codes we've talked about so far this month are really pretty simple, and frankly, most could be cracked pretty easily. Modern cryptography (the mathematics of codes) is much more complicated, and it's a good thing that's true. In today's world, an awful lot of business is done electronically. That means that information like account numbers, sums of money, and personal data are flying through the Internet. Obviously, we want to be confident that this information issecure, that no bad guys can get hold of it.

Modern cryptography uses pretty sophisticated mathematics to hide information as it is transmitted. This often involves really large prime numbers, numbers that can't be factored into numbers other than 1 and themselves. Examples of primes are 2 (the only even prime number), 3, 7, 59, 97, 311, 971, or 2129. The basic idea is that the real information is combined with some crazy huge random prime number that is known to the receiver of the information. So, as the data is transmitted, it is secret, but can be decoded at the receiving end. The assumption is that it would take too long for a bad guy to try to guess or figure out the prime number, so he's out of luck!

Of course, this is a really simplified explanation of one type of modern secret codes. If you want to learn more, and aren't afraid of some math, check out this video lecture, "Cryptography -Science or Magic?", by Dr. James Massey, an expert in cryptography. He was speaking at the Massachusetts Institute of Technology in Cambridge MA in 2001, and the video is presented by MIT World, which offers lots of lectures on various topics. (Please note that the introduction is pretty long, and Massey's actual lecture starts around 6:50 on the timer.)

Tuesday, October 18, 2011

The Tale of the Scytale

Here's a coding device that was used by the ancient Romans! It's called a scytale, which rhymes with "Italy", which is funny, because the Romans lived in ... Italy! The scytale doesn't so much use a code as create a way to hide a message. A scytale is simply a cylinder about which a long strip of paper is wrapped. A message is written across the paper, which is then unwrapped. The letters are all broken up, and can only be easily read when the paper is wrapped around another cylinder of the same size. Here's how you can make your own scytale:

What You'll Need:
2 cylinders of the same size, 1/2 - 1 inch in diameter (try using a marker)
Strip of paper 1/2 x 8 inches
Pen

Wrap the strip of paper around the cylinder as shown in the picture at right. Write a message across the paper, right over the edges. Unwrap the paper and look at it. How easy is it to read the message? Now re-wrap the paper around the other cylinder, starting at the end. The letters should line up, and the message re-appears! Try wrapping the paper around cylinders of other sizes, like a pencil or a paper-towel roll. Can you read the message using these scytales?

Do you think that this was a very good way to hide a message? Just go easy on those ancient Romans - this was very early in the history of secret codes!

Monday, October 17, 2011

Secret Decoder Wheel

The cryptograms discussed last week are a kind of substitution code, in which one letter is replaced by another. Some of the other codes listed a few days ago (such as Morse code and semaphore) are also based on substitutions, but with special symbols replacing the letters. You can make your own special code by creating your own symbols - a personal alphabet! If you tell your friends what the symbols mean, you can send secret messages back and forth.

You can even make a secret decoder wheel using this pattern.

What You'll Need:
Secret decoder wheel pattern
Scissors
Thumbtack
Eraser
Pencil

Cut out the two wheels. Write a 36-symbol secret alphabet in the spaces of the inner (smaller) wheel. There's room for the letters A - Z and the numbers 0 - 9. Line up the two wheels so that the black dots are on top of each other. Push a thumbtack through the black dots and stick the point into an eraser so that you don't hurt yourself. Turn the inner wheel to line up one of your symbols with the letter "A"; this is called the key. You can then read all the other letters directly. Don't forget to make another wheel for your friend who will receive your messages, and to give him or her the key!

If you later want to create another code, you can simply line up another symbol with "A", and tell your friend what the new key is! Happy coding!

Sunday, October 16, 2011

Yipes! Stripes!

There's a kind of code you see every day, but may not think about much. It's the UPC (Universal Product Code) bar code, those striped patterns that are found on everything you buy. What do they mean? How can you decode them?

Every product has a unique 12-digit UPC code, which indicates both the manufacturer (first 6 digits) and the product (last six digits). Different sizes, different flavors, different colors - all have their own special codes. Stores can easily keep track of their inventory and update prices. They can even keep track of what customers are buying. Checkout is faster and more accurate because the code is read by a laser, rather than by a person.

One of the things you first notice about the black stripes in a bar code is that they are of different widths. There are skinny bars, bars twice the thickness of the skinny ones, bars three times the thickness of the skinny bars, and bars four times the thickness of the skinny ones. Actually, bar codes also include the white strips between the black bars, and they also come in all four widths. We'll call single-width black bars 1B, triple width white bars 3W, and so on. The ten numerical digits are given by:

0 = 3W 2B 1W 1B
1 = 2W 2B 2W 1B
2 = 2W 1B 2W 2B
3 = 1W 4B 1W B1
4 = 1W 1B 3W 2B
5 = 1W 2B 3W 1B
6 = 1W 1B 1W 4B
7 = 1W 3B 1W 2B
8 = 1W 2B 1W 3B
9 = 3W 1B 1W 2B

Every bar code reads from left to right. The first three stripes are always the same (1B 1W 1B). This is the start code, and it tells the computer reading it where the code will begin. Then you start reading four bars at a time. You will notice that the numbers that correspond to the bar code are also written along the bottom. The last three bars are 1B 1W 1B again, which is a stop code.

Maybe you're thinking - there are lots and lots of different products out there - are there enough UPC codes for all of them? No worry - there are actually 1,000,000,000,000 possible codes! We won't run out any time soon!

Check out some bar codes, and see if you can identify the numbers. OK, so decoding these bars isn't super-exciting, and it can make your eyes hurt! But at least now you know more about them!

Saturday, October 15, 2011

Loads of Codes

Many different kinds of codes have been used to communicate information throughout history. What do you know about these codes?
  • Morse Code consists of "dots" and "dashes" that combine to form letters. It was used to send telegraph messages. Here's a translator program that will convert a text message to Morse code.
  • Flag Semaphore has been used to send messages from one ship out on the ocean to another. The message-sender holds two flags in specific positions that stand for letters and numbers. Check out this site which will show you how this works.
  • Braille is a system of raised dots symbolizing letters and numbers which allows the blind to read text.
  • Zip codes are used to help direct mail to the correct city or area.
  • Police codes are used to send law-enforcement information over the radio.
  • Alpha-bravo code actually replaces letters with words to help avoid confusion when single letters are used.

Monday, October 10, 2011

Cryptograms

Here's another kind of simple code - a substitution code. Simply rearrange the letters of the alphabet so that one letter stands for another. For example, this month's topic is written in a substitution code:

XWFOWR FEBWX

where X = S, W = E, F = C, O = R, R = T, E = O, and B = D.

Substitution codes are used to create word puzzles known as cryptograms. A word, message, or sentence is written in code, often without any clues! Here's an example (a quote from Abraham Lincoln):

This certainly doesn't look like English! How can you solve it?CH HAHCZHG QG RWS VQJH
Q BPZHAX ZG WAH TVW VQG EVH GQ

There are a couple of strategies that can be used. Note that the quote starts with a single letter, Q. How many one-letter words can you think of? Just A and I, right? Let's try replacing all the Q's with A's and see what happens:





OK, now what? We have two two-letter words, ZG and QG. We believe that one starts with an A. What are some common two-letter words that start with A? AN, AS, or AT. Now, ZG must start with a vowel and end with N, S, or T: EN, ES, ET? Umm, no. Real possibilities include IN, IS, IT, ON, or US. Look at the first three words: "A [blank] __...". Which possibilities seem to fit? How about "A [blank] IS..." Let's try changing

the Z's into I's and G's into S's and see what we get:




Another trick is to count how often letters occur. In English, E is the most common letter, and we see that there are a lot of H's in this puzzle. Let's try replacing the H's by E's, and see if that helps.





What about the word HAHCZHG, which we've now decoded as E_E_IES. What might this word be? How about ENEMIES? So, now we can try N for A and M for C:





Hey, look! We've also decoded the word SAME! This suggests that we're on the right track! A common three-letter word that ends in E is THE - maybe that's what EVH is:





Now look at WAH, which has been partially decoded as _NE. The W must really be an O!





This is getting easier! TVW, which has become _HO must be WHO:





If we're talking about ENEMIES at the end of the sentence, maybe the second word is FRIEND!




What about the last word? HATE? No, because a J is not a T. HAVE?





Can you figure out the last word, _O_?

Saturday, October 1, 2011

Suppose You Transpose

Here's your first type of secret code! This is called a transposition code. "Transposition" simply means a change in position. In this kind of code, you and your partner agree on a number, then move each letter of a word over to the right that number of spaces, wrapping the end numbers around to the front. For example, for a transposition number of 2, this happens to the word "CODE": the first letter, "C", becomes the third (1+2), the "O" becomes the fourth, the "D" becomes the first, and the "E" becomes the second. So the secret form of this word is: DECO. Would you have guessed that meant "CODE" if you didn't know the trick?

Try writing these words in transposition code (the number is shown in parentheses):

SECRET (3)
ORANGE (1)
OCTOPUS (4)

Now try decoding these words!
AFFEGIR (4)
BEROCTO (3)
CHOOLS (1)

Once you have the hang of the transposition code, write a longer message to a friend and see if he or she can read it!

Secret Agent!

Imagine that you live the exciting life of an international spy. You need to get messages to your partners, while keeping this information safe from your enemies. How can you do this? Easy - invent a secret code that only you and your partner can understand! Some codes, like the Morse Code, aren't really secret, but have been used to send information for a long time. Other codes, like sign language, stand in for spoken language. This month, you'll learn about many different types of codes, and develop one of your own!