• 

J. 

-1-

PRELIMINARY INSTRUCTIONS FOR CHAOCIPHER II 

J: . CHAOCIPHER II: GENERAL INFORMATION 

CHAO II is a gener<:d purpose file encryption algorit.hm· wroich use.s 

a keyword or key phrase entered from t.he keyboard in order t.o 

scramble data. The key can be anything which may be entered from 

the keyboard, including blanks and other special characters. The 

key has a r11inirnum length of 10 characters t•ut can t•e up t.o 50 

characters long. All characters in a key are significant. The 

key is case sensitive, i.e., tt-1e key MISSISSIPPI and the key 

111ISSIS:3If'f'I are not the same . When the key is entereoj, the 

program calculates a 16 bit "keycheck" which is shown on the 

screen. These keycheck digits may be used t.o confirm the key 

upon decipherment of the file. Although this use is opt.ional, it 

is recommended that troe user keep a list C•f encrypt.ed files and 

their correspondi ng keycheck digits to prevent accidental file 

dee ipherment using an incorrect. key . The actual key to t.he 

cipher should, of course, be stored elsewhere in a safe place or 

cornmi tted to memory by tt-ie user. 

As is well known, there are two broad classifications of 

encrypt.ion algorithms: key generators a.nd alphabet generators 

(often called strearo ciQ.t"1t::rs arid t:ilc'.ck c:!_i;•~t~J:.§., resr:•ect.ively . ) 

CHAO II is an alphabet. generati11g algorithm with plaint.e>tt 

feedback features <as was the original CHAOCIPHER). CHAO 11 

enciphers one byte of data at a time . The encrypted file has the 

same size and name as the original file . Encrypted files are 

ii;visible to •:Ordi11ary directory s;;,arches made usi ng the DIR 

command. A list of CHAO encrypted files in a particular 

directory Cc<n be obt<<ined by r11aking thc<t directory the active one 

and using the CHAOCATCalog) program. 

The system requi rer11ent.s for the 1..1se C•f CHAO I I are a IBM c•r IBM 

compatible computer running MS DOS or PC DOS 2.1 or higher. The 

program requires about 37K of memory i n order to run . This 

amount. c.f memory is needed n co matt.er wt-oat the size of file to be 

encrypted . All files are sc rambled in 32K chunks . Thus, of t he 

required 37K, about SK is needed fo r the program and the rest is 

used for temporary storage of the file data. When encrypt.ion or 

decryption is finished, all file data and keying data are erased 

from the computer memory. The encrypted/decrypted file 

overwrites the original file on the disk. 

Typical data encrypt.icm rates for 32K of data are given ·below . 

COMF'IJTER PROCESSOR CLOCKSF'EED ENCRYPTION RATE 

(MHz) (BITS/SEC) 

TANDY 1 000 t3088 4 10,000 

TANDY 1 OOOTX 80286 ::: 26,200 

IBM PC 8088 4 

IBM XT '3086 6 

-

-

-

-

-

-

-

-

-

-
-2-

IBM AT 80286 8 

IBM MODEL 2S 8086 

IBM MODEL 30 ::::086 

IBM MODEL so 80286 

IBM MODEL 60 80286 

IBM MODEL 80 80386 

Since encrypted files are straight binary, users wishing to 

transmit them over telecommunications networks should remember to 

use a transmission protocol such as Xmodem, Ymodem, Kermit, etc. 

II.INSTALLATION OF THE CHAO II SYSTEM 

Assuming tr.at the installation is to reside on hard disk drive C, 

all that is necess ary is to create an appropriate direc tory and 

copy the files frc•m the purchased disk intc• that direc tory. 

From the root directory, C:\, with t he CHAO II disk in drive A, 

the installation would consist of the following steps: 

MD CHAO 

CD CHAO 

COPY A:* · * 

CCreate the directory) 

CEnter the directory) 

(Copy all of the files on drive A into the 

CHAO directory) 

In order to u s e CHAO II on any file in any directory, the user 

should add the directory searct-1 path C:\CHAO to his PATH 

state ment in the AUTOEXEC.BAT file . This amounts to adding a 

statement 

PATH=C:\CHAO 

to the file AUTOEXEC.E:AT. If the PATH statement already exists, 

do nr.•t enter a second PATH statement since t.t-1is would nullify the 

first one. Merely add t1"1e path tc• the e x isting ones. For 

example, if the current PATH statement reads s omething like 

PATH=C:\DOS;C:\BATCH 

PATH=C:\DOS;C:\BATCH;C:\CHAO 

-
-:3-

A DIR comm;~nd on t h e CHAO will show the follc•wing fi·les: 

CHAD.EXE : The cipher algorithm 

CHAOCAT. COM : ( Ct-1aocatalc•g) Uti l i t.y p rogram to search t.he 

current. directory for CHAO II encrypted fila5 

CHAOSET.COM Utility program to read and set file attributes. 

This program is useful i n demonstrating t.he 

operation of the CHAO II program 

SAMPLE.TXT A sample EMAIL text file used to deroonstrate the 

operation of CHAO II 

All of these files are in standard fc•rmats and none is copy 

protected in any manner. Don't for get to r~ake backup copies! 

III. INSTRLICTION SUMMARY 

In order to encipher a file, the user has only to issue the 

comr11and: 

CHAO filename 

where "f i 1 ename" i.s tr1e file or pathname of the object to be 

enciphered . 

EXAMPLE : CHAO RECEIPT:!::. JAN or CHAO C: \ INCOME\RECEIPT~:. JAN 

The prograro then asks for a key which is then entered by the 

user. The encryptic•n process prc•ceeds with the prc.grar11 issuing a 

"keycheck" block of four hexadecimal digits along with the 

starting and ending encryptio11 times for each 32K block in the 

file. 

After the file is encrypted, the ciphertext file (of the same 

name) resides in the same directory but appears to have 

"disappeared". This occurs because the CHAO I I program cf-1<1nges 

the ciphered file's attribute byte from its current value to 26H 

which declares it as an "invisible" file. 

To view all encrypted files in the current disk directory <i.e. 

al l files with attribute 26H>, the user issues the command: 

CHAOCAT 

The c omroar1d to dee i pher a file is exact 1 y t.he same as that. used 

to c,ncipher it. 

CHAO filename 
-4-

The program first checks the file attribute byte and discovers 

this to be a decryption opecation (because the a'Ltril:•ute byte is 

26H). The cipher key is entere.j as before. The keycheck strin•,;i 

is printed on the screen as previously , but, this time the 

prcu,;iram stops so that tl"1e user may check tl"1e new keycheck byte 

agai nst the original one bef ore proceeding . This procedure helps 

to reduce the probabil i~y of entering an incorrec t decipherment 

key . 

In botl"1 c <.~ses, if the f i l enaroe is n c•t entered on the c orllfAand 

line , the program will prorop'L the user for it . 

I V. MINI TUTORIAL 

The user can now der11on strate to 1".ir11self hc.w CHAO II scrambles 

data as well as some other aspects of the operation o f t his 

c r yptographic syst.er11. E<<ch st.ep in t he fol lowin•;;i procedure 

s h ould be perforr11ed on the c •:•r11puter as t h e text is r ead. The 

file SAMPLE. TXT, a siroulat.e•j i n t .,roffice Er11a il message, i.s 

included with the c haociph e r files to serve as a d emonstration 

file . We assume t hat the reader has est~<blished a directory named 

CHAO on t h e h a rd disk, C:, and has successfully copied the 

C•:•ntents c•f tr1e disk purc hased into that directory. Data entered 

by the user is indicated in boldface type. 

First, we roake C:\CHAO the active director y, i f necessary, by 

i ssuing t he DOS commaii.j ."C:" f o llowed by the command "CO CHAO". 

We c<1n tak e a l ook at SAMPLE . TXT before enciphering it by using 

t he DOS type command type command 

TYPE SAMPLE.TXT 

The reader should examine tr1e t e>,:t file on tl"1e screen. 

Ne>(t, we will encrypt t he file with t.he cc•romand 

CHAO SAMPLE.TXT 

Tr1is CC•ff1rr1an1j produces tr1e output s hown below where the u10er h as 

entered t he cipher key "MARY HAO A LITTLE##!??" . 

'· 
• 

-5-

LHn D II 

CHAOCIPHER II ... .. All rights reserved 

ENTER YOUR KEY: MARY HAO A LITTLE ttl?? 

ENCIPHERING ... 

KEYCHECK = 8136 

08 : 4 1 : 09 : 35 

08:41 :09:57 

Note that the key has some special cl-1araclers, namely, "##1??" 

which make it difficult to guess or obtain the key by exhaustive 

search. Inserting such characters into otherwise easy to 

remember keys is a good practice. 

The keycheck string is "8136" which should be written down along 

with the filename for use in checking t he key during 

decipherment. 

The starting and ending times for the encipherment are also 

shown Since this file is less that 32K bytes in size, only two 

limes appear. If the file being encrypted is larger than 32K, 

then the beginning and ending times for each block encryption are 

displayed . 

If we now give the directory command 

DIR SAMPLE.TXT 

the, the resultant output i s 

Volume in drive C has no lat:1el 

Directory of C:\CHAO 

File not found 

which shows that the enciphered file is invisible to directory 

searches . 

Issuing the command 

CHAOCAT 

again reveals t.t·1e presence c1f tt-1e fil e with the output: 
-6-

~ CHAO CATALOG ~ 

SAMPLE.TXT 

ENO OF ENCRYPTED FILE LIST ... 

However, we could also change the file attribute of SAMPLE .TXT 

using the CHAOSET program. Issuing the command 

CHAOSET 

proo:luces the output 

FILE ATTRIBUTE SETTER 

ENTER NAME OF FILE: SAMPLE.TXT 

THE CURRENT FILE ATTRIBUTE IS <HEX) 26 

BIT 0= 1 READ ONLY BIT 1=1 HIDDEN FILE 

BIT 2=1 SYSTEM FILE BIT 5=1 ARCHIVE 

ENTER NEW ATTRIBUTE (2 HEX CHAR) OR CR TO END: . oo 

FILE ATTRIBUTE RESET . . . 

where the user has entered the filename, SAMPLE.TXT, and the new 

file at.trit•ute byte 00 . ("Normal" files will have the attributes 

20H or 00.) At this point, the command 

DIR SAMPLE 

now produces t.he output. 

Volume in drive C has no label 

Directory of C:\CHAO 

SAMPLE TXT 639 12-24-90 8:41a 

1 File(s) 1947648 bytes free 

which now reveals the presence of the file in the •Jirectory. 

The reader should now issue the CHAOSET command a second time and 

chai,ge the SAMPLE. TXT file attribute back from 00 t.o 26. Without 

this change, the CHAO program would attempt to reencipher the 

file instead of deciphering it. 

An attempt to view the enciphered file by usii,g the· command 
-7-

TYPE SAMPLE . TXT 

produces an out.put. of jibberish l ike t.he following 

<The reader will not. see e xactl y t.he same output but only a 

similar one since the printer which produced this display 

interprets sorn ... characte rs differently from the DOS tocreen 

driver . ) 

Even t.hc.ugl-1 the file is 636 b ytes long, only a ha11dful of 

characters appear on the screen before t.he printing terminates. 

In this case, t he printing termi nated because the next c ipher 

byte after the c hurac ter "A" Wc<S 1 AH which is interpreted by the 

DOS TYPE command as troe end of t he file marker. In order to view 

t he actual file, some uti li ty program s uch as DEBUG or NORTON can 

be used in order to see the hexadecimal representation o f the 

s tor ed data . 

We can now decipher the f ile using the command 

CHAO 

The filename was omitted in this command but the program prompts 

for it, the output look s thus ly, 

LHFl D II 

CHAOCIPHER II ..... All rights reser ve d 

ENTER NAME OF FILE : SAMPLE.TXT 

ENTER YOIJR KEY: MARY HAO A LITTLE IUl 177 

DECI PHERING . .. 

KEYCHECK = 8 136 

PROCEED •.JITH DECIPHERMENT CY/NJ? ,y 

09:12:53:35 

09 : 1 2 : 53 : 56 

• 

I 

In the above the user has entered the filename, SAMPLE .TXT as 

well as the origi nal key. The keycheck digits, which are 

ca lculated from the entered key, 8 136, match the original digits 

and so, in all p robabi lity, the correct key has been entered. 

The u ser t.roen t.ypes a "Y" t o continue with the decipherment. 

V. SAMPLE TEXTS 
-aThe following two examples show how a single bi t difference in 

t.he key or plaintext will, in general. completely alter the 

encrypted file. In each case, the line PLTXT shows the plaint.ext 

charact.ers, P-HEX shows t.he hexidecimal represent.at.ion of each 

plaintext character in ASCII, and, t.he CIPHR line shows the 

ciphertext bytes of the encrypted text. The last three 

characters in each text are the usual text file terminators: 

OO=carriage return, OA=li nefeed, 1A•EOF marker . 

EXAMPLE 1: SAME KEY, PLAINTEXTS DIFFERING BY ONE BIT 

PLTXT: 

P-HEX: 

CIPHR: 

PLTXT: 

P-HEX: 

CIPHR: 

PLTXT: 

KEY: LONE STAR STATE CKEYCHECK=0017) 

T H E Y E L L 0 W R 0 

54 48 45 20 59 

32 68 AD DS C9 

45 4C 4C 4F 57 20 52 4F 

14 86 98 53 Bl 60 86 38 

0 

4F 

25 

F T E X 

46 20 54 45 58 

3C EE BO 53 08 

A S 

41 53 

05 87 

00 OA 1A 

Ga ac 41 

W R 

s 

53 

ES 

E 

4.S 

AS 

S E 

20 

62 

P-HEX: 

CIPHR: 

t H E 

54 48 45 

2C 4:;: AF 

y 

20 59 

37 80 

E L 

45 4C 

04 66 

L 0 

4C 4F 

06 87 

57 20 .52 

BO BF EB 

0 

4F 

6C 

53 45 20 

E7 46 9F 

PLTXT: 

P-HEX: 

CIPHR: 

D F 

4F 46 

F5 7A 

T 

20 54 

6E C4 

E 

45 

SB 

X A 

58 41 

F7 C7 

53 OD OA IA 

80 48 EA OF 

Even though the same key produces wildly dissimilar out.put for two 

different files, it is not recommended t.o use the sarne key to encipher 

a large number of files. Preferabl y the key for each file would be 

different. 

EXAMPLE 2: SAME PLAINTEXT, KEYS DIFFERI NG BY ONE BIT. 

KEY 1: REMEMBER THE ALAMO! <KEYCHECK=3848) 

PLTXT: 

P-HEX: 

CIPHR: 

PLTXT: 

P-HEX: 

CIPHR: 

T H E 

54 48 45 

CC 9E 58 

y 

20 59 

EO 67 

0 F T E 

4F 46 20 .S4 45 

86 49 Cl F6 36 

E 

45 

20 

L 

4C 

37 

L 0 

4C 4F 

E9 CS 

X A S 

w 

57 

09 

20 

02 

.SS 4 1 53 OD OA 1 A 

04 32 63 58 2A 09 

R 

52 

F4 

0 s 

4F 53 

67. 17 

E 

45 

01 

20 

74 
• 

-9-

KEY 2: rEMEMBER THE ALAMO! <KEYCHECK=BC64) 

PLTXT: T H E y E L L 0 w R 0 s e: 

P-HEX: 54 48 45 20 59 45 4C 4C 4F 57 20 52 4F 53 45 20 

CIPHR: 52 9E Cl 26 Bl 68 C6 04 92 DC EF SC E2 33 38 Al 

F'LTXT: 0 F T E x A C:· 

"' P-HEX: 4F 46 20 54 45 58 41 53 OD OA lA 

CIPHR: Fl E7 17 2A 4A 80 18 C7 54 C2 51 

VI.SECURITY HINTS 

The reader will note that. we have not. yet. made any claims as 1.ci 

t.he security of CHAD II, nor h;iive we issued any solution 

challenges. First., t.he security of almost. all algorithms depends 

largely on the manner i n which they are e mployed. Statements 

proclaiming an algorithm to be absolutely unbreakable, etc. 

really have no meaning or validity. Second, it. is of little use 

t.o issue challenges t.o the world at large t.o solve such a suct-1 a 

cipher given what.ever data that. the alogrithm's author wishes to 

provide. A serious challenge of this sort would include a 

complete description of the algorithm and a description of it.s 

r11et.hod of use as well as data to work cm which would be 

consistent witt-1 that whict-1 might be expected to be obt.11.ined using 

a proposed r11et.hod of crypt.analytic att.ack . Unless thi! 

algorithm's creator h as made a grevious design or programming 

error, the determination of the security and suit.ability of an 

.:,lgorithro is probably going to require much time and e-nergy. 

In our opinion, if keys are chosen wisely so that. they are not. 

liable t.o be guessed or obtained under exhaustive search 

conditions, then, the CHAO II cipher will provide good 

cryptographic protect.ion even if t.he plaint.ext of a good many 

files is known t.o adversaries. The level of security certainly 

e x ceeds that of any commercial product known to t.he author. 

If a user accident.ly deciphers a file with the wrong key the 

result. will be a further scrambled set. of data. This mistake 

wi 11 be discovered as soon t.r1e an attempt. is made t.o use the f i l;;, 

in a program o r t.o view it.s contents. The best procedure in this; 

instance, is t.o re-encipher t.he file using t.he same incorrect key 

as previously . In this way, t.he original encrypted file is 

restored and t.he user can now enter t.he correct key for 

dee i pherroe11t.. 

No encrypt.ion algorithm is more secure than it.s operating system 

environment. Consequently, if t.he program or encrypted d<:, ta 

files can be altered, t.he user will be unable t.o utilise the 

cipher program successfully . Alt.hough a system penetrator will 

be unable t.o r.,ad the encrypted data himself, he may also render 

the data undecipherable to t.he legi t.ir~ate users of t.he system. 

If system securi t.y is t.t-iought. t.o be a problem, then t.he program 
-

I 

-10-

and rel;;d .. ed dat.a files should be prot.ected fror11 alt.erat.ion or 

misuse wit.h one of t.he numerous "virus" protect.ion programs 

available. The DOS File Compare operation can also be used to 

check against. altered data . 

... 

.....