Example output of Cipher program.

User input is shown in bold. Different runs of the program are separated with lines of *'s.

MAX_ROWS set to 6: (this is not part of the program output)

This program demonstrates a transposition cipher.
A cipher is an algorithm to encrypt or decrypt a message.

This program will demonstrate encrypting a message with
a columnar transposition cipher both with and without
padding characters. The program will then decrypt a message
assuming it was encrypted with a columnar transposition cipher
with padding.


A demonstration of encrypting with a columnar transposition cipher:

Enter the message to encrypt: Hook_'em_Horns!!!

Message encrypted with columnar transposition cipher and no padding.
Encrypted with 2 rows: Ho_e_on!!ok'mHrs!
Encrypted with 3 rows: HkeHn!o_mos!o'_r!
Encrypted with 4 rows: H__n!o'Hsoeo!kmr!
Encrypted with 5 rows: H'o!oer!omnk_s_H!
Encrypted with 6 rows: Henomso_!kH!_o!'r

Message encrypted with columnar transposition cipher and padding.

Clear text padded for 2 rows: Hook_'em_Horns!!!X
Encrypted with 2 rows: Ho_e_on!!ok'mHrs!X

Clear text padded for 3 rows: Hook_'em_Horns!!!X
Encrypted with 3 rows: HkeHn!o_mos!o'_r!X

Clear text padded for 4 rows: Hook_'em_Horns!!!XXX
Encrypted with 4 rows: H__n!o'HsXoeo!Xkmr!X

Clear text padded for 5 rows: Hook_'em_Horns!!!XXX
Encrypted with 5 rows: H'o!oer!omnXk_sX_H!X

Clear text padded for 6 rows: Hook_'em_Horns!!!X
Encrypted with 6 rows: Henomso_!kH!_o!'rX


A demonstration of decrypting with a columnar transposition cipher:
If the length of the message is not a multiple of the number of rows
it will be padded which may throw off the decryption.

Enter the message to decrypt: H__n!o'HsXoeo!Xkmr!X

Messages Decrypted with a Columnar Transposition Cipher

Decrypted text padded for 2 rows: H__n!o'HsXoeo!Xkmr!X
Decrypted with 2 rows: Ho_e_on!!Xok'mHrs!XX

Decrypted text padded for 3 rows: H__n!o'HsXoeo!Xkmr!XX
Decrypted with 3 rows: HHX_sk_Xmnor!e!ooX'!X

Decrypted text padded for 4 rows: H__n!o'HsXoeo!Xkmr!X
Decrypted with 4 rows: Hook_'em_Horns!!!XXX

Decrypted text padded for 5 rows: H__n!o'HsXoeo!Xkmr!X
Decrypted with 5 rows: H!som_oX!r_'oX!nHekX

Decrypted text padded for 6 rows: H__n!o'HsXoeo!Xkmr!XXXXX
Decrypted with 6 rows: H!somX_oX!rX_'oX!XnHekXX

This displays automatic tests of the program:

expected: ABCDEFGHIJXX, actual: ABCDEFGHIJXX
passed decrypt test1

expected: COMPUTER!, actual: COMPUTER!
passed decrypt test2

expected: DCleSll_XlHX_aX, actual: DCleSll_XlHX_aX
passed encrypt test1

expected: Tsnre_gnxLhsaooX, actual: Tsnre_gnxLhsaooX
passed encrypt test2

***********************************************************

MAX_ROWS set to 4: (this is not part of the program output)

This program demonstrates a transposition cipher.
A cipher is an algorithm to encrypt or decrypt a message.

This program will demonstrate encrypting a message with
a columnar transposition cipher both with and without
padding characters. The program will then decrypt a message
assuming it was encrypted with a columnar transposition cipher
with padding.


A demonstration of encrypting with a columnar transposition cipher:

Enter the message to encrypt: Computer_Science

Message encrypted with columnar transposition cipher and no padding.
Encrypted with 2 rows: Cmue_cecoptrSine
Encrypted with 3 rows: CpeSeeourcnmt_ic
Encrypted with 4 rows: Cu_eotSnmeccprie

Message encrypted with columnar transposition cipher and padding.

Clear text padded for 2 rows: Computer_Science
Encrypted with 2 rows: Cmue_cecoptrSine

Clear text padded for 3 rows: Computer_ScienceXX
Encrypted with 3 rows: CpeSeeourcnXmt_icX

Clear text padded for 4 rows: Computer_Science
Encrypted with 4 rows: Cu_eotSnmeccprie


A demonstration of decrypting with a columnar transposition cipher:
If the length of the message is not a multiple of the number of rows
it will be padded which may throw off the decryption.

Enter the message to decrypt: CpeSeeourcnXmt_icX

Messages Decrypted with a Columnar Transposition Cipher

Decrypted text padded for 2 rows: CpeSeeourcnXmt_icX
Decrypted with 2 rows: CcpneXSmete_oiucrX

Decrypted text padded for 3 rows: CpeSeeourcnXmt_icX
Decrypted with 3 rows: Computer_ScienceXX

Decrypted text padded for 4 rows: CpeSeeourcnXmt_icXXX
Decrypted with 4 rows: CenipoXceumXSrtXec_X

***********************************************************

MAX_ROWS set to 6. The encrypted message does not have padding so none of the decryption attempts work. (this is not part of the program output)

This program demonstrates a transposition cipher.
A cipher is an algorithm to encrypt or decrypt a message.

This program will demonstrate encrypting a message with
a columnar transposition cipher both with and without
padding characters. The program will then decrypt a message
assuming it was encrypted with a columnar transposition cipher
with padding.


A demonstration of encrypting with a columnar transposition cipher:

Enter the message to encrypt: Hook_'em_Horns!!!

Message encrypted with columnar transposition cipher and no padding.
Encrypted with 2 rows: Ho_e_on!!ok'mHrs!
Encrypted with 3 rows: HkeHn!o_mos!o'_r!
Encrypted with 4 rows: H__n!o'Hsoeo!kmr!
Encrypted with 5 rows: H'o!oer!omnk_s_H!
Encrypted with 6 rows: Henomso_!kH!_o!'r

Message encrypted with columnar transposition cipher and padding.

Clear text padded for 2 rows: Hook_'em_Horns!!!X
Encrypted with 2 rows: Ho_e_on!!ok'mHrs!X

Clear text padded for 3 rows: Hook_'em_Horns!!!X
Encrypted with 3 rows: HkeHn!o_mos!o'_r!X

Clear text padded for 4 rows: Hook_'em_Horns!!!XXX
Encrypted with 4 rows: H__n!o'HsXoeo!Xkmr!X

Clear text padded for 5 rows: Hook_'em_Horns!!!XXX
Encrypted with 5 rows: H'o!oer!omnXk_sX_H!X

Clear text padded for 6 rows: Hook_'em_Horns!!!X
Encrypted with 6 rows: Henomso_!kH!_o!'rX


A demonstration of decrypting with a columnar transposition cipher:
If the length of the message is not a multiple of the number of rows
it will be padded which may throw off the decryption.

Enter the message to decrypt: H'o!oer!omnk_s_H!

Messages Decrypted with a Columnar Transposition Cipher

Decrypted text padded for 2 rows: H'o!oer!omnk_s_H!X
Decrypted with 2 rows: Hm'nok!_ose_rH!!oX

Decrypted text padded for 3 rows: H'o!oer!omnk_s_H!X
Decrypted with 3 rows: Hr_'!soo_!mHon!ekX

Decrypted text padded for 4 rows: H'o!oer!omnk_s_H!XXX
Decrypted with 4 rows: HenH'rk!o!_X!osXom_X

Decrypted text padded for 5 rows: H'o!oer!omnk_s_H!XXX
Decrypted with 5 rows: Hoo_!'emsXorn_X!!kHX

Decrypted text padded for 6 rows: H'o!oer!omnk_s_H!X
Decrypted with 6 rows: H!rm_H'o!ns!oeok_X

***********************************************************

MAX_ROWS set to 6 and a message in length less than the number of rows in some cases: (this is not part of the program output)

This program demonstrates a transposition cipher.
A cipher is an algorithm to encrypt or decrypt a message.

This program will demonstrate encrypting a message with
a columnar transposition cipher both with and without
padding characters. The program will then decrypt a message
assuming it was encrypted with a columnar transposition cipher
with padding.


A demonstration of encrypting with a columnar transposition cipher:

Enter the message to encrypt: UTCS

Message encrypted with columnar transposition cipher and no padding.
Encrypted with 2 rows: UCTS
Encrypted with 3 rows: USTC
Encrypted with 4 rows: UTCS
Encrypted with 5 rows: UTCS
Encrypted with 6 rows: UTCS

Message encrypted with columnar transposition cipher and padding.

Clear text padded for 2 rows: UTCS
Encrypted with 2 rows: UCTS

Clear text padded for 3 rows: UTCSXX
Encrypted with 3 rows: USTXCX

Clear text padded for 4 rows: UTCS
Encrypted with 4 rows: UTCS

Clear text padded for 5 rows: UTCSX
Encrypted with 5 rows: UTCSX

Clear text padded for 6 rows: UTCSXX
Encrypted with 6 rows: UTCSXX


A demonstration of decrypting with a columnar transposition cipher:
If the length of the message is not a multiple of the number of rows
it will be padded which may throw off the decryption.

Enter the message to decrypt: UTCSXX

Messages Decrypted with a Columnar Transposition Cipher

Decrypted text padded for 2 rows: UTCSXX
Decrypted with 2 rows: USTXCX

Decrypted text padded for 3 rows: UTCSXX
Decrypted with 3 rows: UCXTSX

Decrypted text padded for 4 rows: UTCSXXXX
Decrypted with 4 rows: UCXXTSXX

Decrypted text padded for 5 rows: UTCSXXXXXX
Decrypted with 5 rows: UCXXXTSXXX

Decrypted text padded for 6 rows: UTCSXX
Decrypted with 6 rows: UTCSXX