Our society is riddled with secrecy and, at times, this is essential. To transfer information from one site to a remote site in a secure way a technique known as enciphering has been used. This uses a cypher (which is Greek for "hidden") to produce cypher text from clear text. The reverse process recovers the original clear text from the cypher (or hidden) text.
Another similar process known as coding is also used. This is also a way of hiding the meaning of a message but here the message is hidden in text that looks like a message, but about some innocent information in which is encoded the real message. Here words in the message text stand for different words in the hidden text. This method is commonly used by close relatives and small businesses to hide the true meaning of seemingly innocent remarks in the presence of others. Enciphering is a process where the cypher text is generated by a mechanical process of replacing the clear text character by character for the cypher text. This process can, not only be applied to written text, but also to data generated by machines and computer program files. Once deciphered these can be used for their original purpose such as a word processor, in the case of a computer program file, or to send to a data processing machine, in the case of data.
During world war two the Germans used an enciphering process known as the "enigma" which was a mechanical method of transforming letters in the clear text to different letters in the cypher text. This was broken by Turing and others at Bletchley Park very early in the conflict and was used with great effect by the allies. Bombing raids could be intercepted once the signals from Germany had been deciphered and this was the daily and nightly task of some of the most gifted men and women during the whole of the duration of the war. Some of the machines used by the Axis have never been fully understood, one of these is the Lorenz machine used to code Hitler's own signals, this has never been dismantled.
More recently, with the advent of computers several mathematicians have produced other enciphering techniques where the object has been to make the process of enciphering and deciphering easy to the authorised person but difficult to impossible for any unauthorised agent. Since computers have arrived the enigma class of process are relatively simple to break as they can be done in a time which is only dependant on the length of the message and the cypher, so new methods had to be invented where the unauthorised agent had an impossibly long job of breaking the code.
The two modern methods that have emerged have been the DES process and the Private and Public key process.
The latter method uses two keys, both of which are integers, one is held by the Authorised reader (the private key) and everyone else can have the public key, usually published in a newspaper. People wanting to send a message to the authorised agent use the public key to encipher their message but only the holder of the private key will be able to decipher the message. This is based on a complex mathematical process in which a pair of prime integers are generated as the two keys. To make the method secure the integers have to be of around one hundred figures. This makes their generation and use only possible by computer programs that can do number crunching with these very long multibyte numbers, normal integer arithmetical methods used on compilers will fail.
The DES method is to break the message up into pairs of sub strings and perform nonlinear function of these and a key string, also broken into pairs. This is summed recursively to make the cypher text. The particular implementation used by the US government relies on a special chip that performs bit shuffling as the non linear function. It is however possible to simplify the method to make an acceptable enciphering procedure with software. Here is a possible solution.
Take the message, consisting of a file of bytes, a byte at a time and the key also a byte at a time. Give the first byte of the output file a set value, multiply it by the first byte of the key and add the first byte of the message. Continue this process using the output of the as the input to the next until the end of the file and then stop. The decipher the cypher text, reverse the process by taking the first byte of the cypher text and subtract from it the byte set in the first place multiplied by the first byte of the key. Continue with this until the end of the file is reached then stop. The clear text will then be found as the output. Put into mathematical terms the process is as follows:
To encipher: O(n+1)=I(n)+O(n)*K(n)
where O(n) is the nth byte of the output file and I(n) the nth byte of the input file K(n) is the nth byte of the key.
To decipher: O(n)=I(n+1)-I(n)*K(n)
To generate the first byte a known process should be applied to the key. It only remains to encipher the file name for storage in the file. This cannot use the cypher as an incorrect file name can cause the computer to crash with possible loss of data, so the file name is enciphered using a fixed cypher and a different enciphering method.