getCipherMessage(randRange(1,5)) randRange(1,25) applyCaesar(M,SHIFT) normEnglishLetterFreq(10) normCipherLetterFreq(C,10) 26 0 25

You intercept the following message, which you know to be encrypted with a Caesar cipher:

C

What shift was applied to the original message?

You can use the graph and slider below to help solve this problem.
Slide the orange dot to adjust the left shift of this message.

init({ range: [ [ -2, LETTERS * 3 + 2 ], [ -9, 6 ] ], scale: [ 6, 24 ] }); for ( var y = 1; y <= 5; ++y ) { style({ stroke: "#000", strokeWidth: 1, opacity: 0.2 }, function() { line( [ 0, y ], [ LETTERS * 3 + 1, y ] ) }); } var cipherFreq = new Array(); for ( var index = 0, indent = 3; index < LETTERS; ++index ) { style({ stroke: "none", fill: "#9ab8ed", opacity: 1.0 }); path([ [ index * indent + 1, 0 ], [ index * indent + 1, FREQ[ index ] * 4 ], [ index * indent + 2, FREQ[ index ] * 4 ], [ index * indent + 2, 0 ], [ index * indent + 1, 0 ] ]); style({ stroke: "none", fill: "#ffc966", opacity: 1.0 }); cipherFreq[index] = path([ [ index * indent + 2, 0 ], [ index * indent + 2, CIPHER_FREQ[ index ] * 4 ], [ index * indent + 3, CIPHER_FREQ[ index ] * 4 ], [ index * indent + 3, 0 ], [ index * indent + 2, 0 ] ]); style({ opacity: 1.0 }); label( [ index * indent + 2, 0 ], "abcdefghijklmnopqrstuvwxyz"[index], "below", false ); } style({ stroke: "#000", strokeWidth: 2, opacity: 1.0 }); line( [ 0, 0 ], [ LETTERS * 3 + 1, 0 ] ); line( [ 0, 0 ], [ 0, 6 ] ); label( [ ( LETTERS * 3 + 1 ) / 2, -0.8 ], "<b>Letter Frequency</b>", "below", false ); style({ stroke: "none", fill: "#9ab8ed", opacity: 1.0 }); path([ [ 0, -2 ], [ 1, -2 ], [ 1, -2.5 ], [ 0, -2.5 ], [ 0, -2 ] ]); style({ stroke: "#000", strokeWidth: 2, opacity: 1.0 }); label( [ 0.5, -2.25 ], "English", "right", false ); style({ stroke: "none", fill: "#ffc966", opacity: 1.0 }); path([ [ 12, -2 ], [ 13, -2 ], [ 13, -2.5 ], [ 12, -2.5 ], [ 12, -2 ] ]); style({ stroke: "#000", strokeWidth: 2, opacity: 1.0 }); label( [ 12, -2.25 ], "Cipher", "right", false ); var indent = 3; var offset = -6; style({arrows: ""}); line( [ 0, offset ], [ UPPER_BOUND * indent, offset ] ); style({arrows: ""}); line( [ 0, offset ], [ LOWER_BOUND, offset ] ); var myLabels = new Array(); style({arrows: ""}); for ( var x = LOWER_BOUND; x <= UPPER_BOUND; x+=1 ) { var markLength; x % 5 === 0 ? markLength = 0.6 : markLength = 0.3 line( [ x * indent, -markLength + offset], [ x * indent, markLength + offset] ); label( [ x * indent, 1 + offset], "abcdefghijklmnopqrstuvwxyz"[x], "center", false); myLabels[x] = label( [ x * indent, -1 + offset ], "abcdefghijklmnopqrstuvwxyz"[x], "center", false); } addMouseLayer(); graph.movablePoint = addMovablePoint({ coord: [0,-6], constraints: { constrainY: true }, snapX: indent }); graph.movablePoint.onMove = function( x, y ) { x = min(x,UPPER_BOUND * indent); var my_x = min(x/indent,UPPER_BOUND * indent); for ( var i = 0; i <= UPPER_BOUND; i+=1 ) { myLabels[i].remove(); cipherFreq[i].remove(); style({ stroke: "none", fill: "#ffc966", opacity: 1.0 }); cipherFreq[i] = path([ [ i * indent + 2, 0 ], [ i * indent + 2, CIPHER_FREQ[ abs(i+my_x) % 26 ] * 4 ], [ i * indent + 3, CIPHER_FREQ[ abs(i+my_x) % 26 ] * 4 ], [ i * indent + 3, 0 ], [ i * indent + 2, 0 ] ]); myLabels[i] = label( [ i * indent, -1 + offset], "abcdefghijklmnopqrstuvwxyz"[abs((i-my_x)+26) % 26], "center", false); } document.getElementById("MsgShift").innerHTML = applyCaesar(C,abs((my_x)-26)) return [ min( max( LOWER_BOUND, x ), UPPER_BOUND * indent ), y ]; };
Cipher Message:
C

Original Message:
C

SHIFT

The letter frequency of the shifted cipher message should be similar to the letter frequency of English in the graph.

Since the original message was shifted right by some value, we want to shift the cipher message frequency to the left, until the frequencies are similarly matched.

Try to find patterns of frequencies. For instance the letters a, e, and h show up frequently in English, and appear close together in the alphabet.

The letters j, q, and z hardly show up at all.

You can use the left shift slider to see what the original message would look like when decrypting it with a specific shift. Drag the orange dot to where you think the encrypted letter 'a' would be in the letter frequency graph.

Adjust the shift to the letter "abcdefghijklmnopqrstuvwxyz"[SHIFT] to see the message

"abcdefghijklmnopqrstuvwxyz"[SHIFT] is SHIFT letter to the right of a. So the original message was shifted by SHIFT

"abcdefghijklmnopqrstuvwxyz"[SHIFT] is SHIFT letters to the right of a. So the original message was shifted by SHIFT