Hi. My name is Adam Saunders and I live in the world of 1's and 0's. This is my tiny contribution the vastness of internet information. It's just an opinion and should you have your own, please comment it!

01 Jan 1998


I have developed two forms of cryptography, know I must be careful about what I say and what I give out over the Internet. Cryptography is an essential and very important part of security. The United States themselves ban the release of certain cryptographic methods even to leave the country. If you know a cryptographic method that someone uses, you can decrypt what ever that person has sort to secure.


As I said I myself have come up with two cryptographic methods, one of which I believe is practically unhackable, even by myself who actually knows the encryption algorithm!(No release of this algorithm is going to occur under any circumstance!!). The other however, although still relatively hard to crack (time wise), I found is similar to encryption methods that many people use around the world. It is pretty simple, but then again it is not an 'ABC' method.

The Method.

The method is relatively simple, as I said before. The method that I am going to teach you consists of a single 128 character key, 2 seeds, and a 6 byte file header (optional).

[Click Here To Download The Example Archive - CRYPT.ZIP]

Below I am going to illustrate the algorithm to encrypt in pseudo-code


 Open source file and check header (use BLOCKREAD and BLOCKWRITE)
IF header IS PRESENT do not allow encryption again
Create destination file
Write header information into new file

Seed Generation
The seed generation is mainly dependant on the "password" (key) the user specifies.

Initialise the two seeds(bytes) to zero
Take another byte and make it the length of the key
seed1 = seed1 + (
ORD( key[ LOOP ] ))* LOOP
seed2 = seed2 + (
ORD( key[ LOOP ] ))* length of key
DEC( length of key )

The reason why the length is put as the seed is so that the key generated can not be of a multiple value. There can only be one key not three or four.

END of Seed Generation

Write seeds into the file (This might seem mad but it allows the decryption program to check if the 'password' is correct)
Read a block from the source file to the buffer array
WHILE amount read in >0 DO
LOOP 1 TO (amount read in)
seed1 = seed1 - LOOP seed2 = seed2 + LOOP
IF odd(LOOP) THEN buffer[LOOP] = buffer[LOOP]-seed1
ELSE buffer[LOOP] = buffer[LOOP]+seed2

Now have all sorts of (NOT, AND, XOR etc etc) in the loop. This will make the encryption method more personal, be careful though, you don't want a "LOOP" where your personal part turns the code back into just what it was originally

Heres an example...
buffer[LOOP] = 123 XOR buffer[LOOP] AND 5
buffer[LOOP] =
NOT buffer[LOOP]

  Write buffer to destination file
  Read next load from the source file to the buffer
  (bytes read) = (bytes read) + (amount read in)
END WHILE statement


Closing The File.
Now we need to close all the files down! Remember, we do not want a hacker to be able to retrieve the original file from the disk by undeleting!!

Rewrite the source file
Clean the buffer by filling it with zeros
Fill the source files with the zeros
Close the source file and destination file
Erase the source file
Rename the destination file to the original source file name


Basically the source file is rewritten to zeros so that it can not be found again on the storage media, and then the destination file is renamed to the same of that of the source so no 'undelete' can be made.

Below I have briefly described the algorithm to decrypt.


This is very similar to the encoding algorithm

The seed generation is the same and the decoding algorithm is that of encoding apart from the AND, XOR, NOT parts you put in come before the ODD seed generations, and they must be in a negative format of the encoding format.

The seed generation part of the algorithm should be opposite. e.g. Where ADD, SUB and visa versa.

Closing algorithm is the same

The opening is slightly different, generate the seeds from the users inputted key and check them against the ones stored in the file.

N.B You can use the 6 bytes of header to see if the file is encrypted or not. (You don't want to decrypt a file that has not been encrypted)



How about using this method, and trying to make it more "unhackable"?!?

  • No Header : Can't tell the encryption type.
  • Multiple Keys : Can encrypt the file several times with different keys can take several life times to crack!!
  • Multiple Seeds : Will not do too much to the encryption strength.
  • Lots more (AND, XOR, NOT, etc.) : In the algorithm adding more 'scramblers' will make the code more scrambled.
  • Do MAD things : Have the name of the file as a key and change the file name to something else! etc etc etc ...

Well that is pretty much it.. Don't be put off by the coding above, it is simpler than it really looks, honest!!
You are now another step further to becoming a master programmer!!!

01 January 1998 01:04 GMT+00:00    Posted By: Adam Saunders
01 Jan 1998


Although Pascal is not a mainstream artificial intelligence (AI) language, you can use it to experiment, I for one enjoy Artificial Intelligence. It is an area of programming where no one has been 100% successful as of yet!!. Normally programs that consist of artificial intelligent algorithms, will mainly be built around the existence of a list of information items that can be extended by the program automatically ie "learns" new things just like we do. In a language like LISP, considered to be the main artifical intelligence language, the language itself performs list maintenance with ease. In Pascal you have to program such procedures by using linked and dynamic allocation, sounds complicated... Not really, if you understand pointers, records etc the program structure is not as complex as it sounds.

Although the example here is very simple, the concepts can be applied to more sophisticated "intelligent" programs.

[Click Here To Download The Example Archive - AI.ZIP]
Thank You To Creative Legacies For The User-Interface Improvement!!

What Is It All About?

One area of AI covers programs that seem to behave like people, this seems to be everyones favourite, ZIGGY springs to mind!!. The famous Eliza program, for example, appeared to be a psychiatrist. It would be wonderful to have a computer program that would carry on a conversation about anything, keep dreaming we are a long way away yet, but getting closer. - it would be a great program to run when you were tired of programming and feeling bored as hell!! The program I have done here used is an extremely simple version of
such a program, it is possible to expand on this program to make it more and more sophisticated, and therefore more like a human. It uses words and their definitions to carry on a simple conversation with the user. One device common to many AI programs is the linking of an informational item with its meaning, in this case, the program links words with their meaning, and descriptions. The following record holds each word, its definition, its part of speech, and its connotation.



const VocabPointer=^vocab;



How The Program Works.

In the program I have generously provided, you enter a word, its definition, the type of word it is, and its connotation of good, bad, or indifferent. To hold these dictionary entries, a linked list is then built, by using dynamic allocation. The procedure DLS_Store creates and maintains a sorted, doubly linked list of the dictionary. After you have entered a few words into the dictionary, you can begin to have a conversation with the computer. For example, you type in a sentance, such as "It is a nice day." The program scans the sentance for a noun that it knows. If it fonds one, it makes a comment about the noun, based on its meaning. If the program encounters a word that it does not know, it prompts you to enter that word with its definition. You type QUIT to exit conversation mode.

The procedure Talk is part of the program that carries on the conversation. A support function called Dissect looks at you input sentence a word at a time. The variable sentance holds you input sentance. Dissect removes a word at a time from sentance and returns it in word. Within the program given here you can find the functions Talk and Dissect.


Well the program its self took me some time to develop, so really I would have loved to have written more about the subject as I really want to develop a high quality artificial intelligent program that could acta as an operating system. Well I can just keep on dreaming!! But neither the less, may be one day....

Now I should think that the example should explain enough to you about how to go ahead with delevoping a better more complex artifical intelligent program. Remember, the program I have written here is only the real basics of writing a top AI system. Heres a few points you should consider if you want to develop this system further. How about making the computer scan your sentance for verbs and then have it substitute an alternative verb in its comment (this will give a much smarter appearence). Or how about getting the system to ask questions?... Its up to you. I have started you off.

01 January 1998 01:02 GMT+00:00    Posted By: Adam Saunders
01 Jan 1998


In this tutorial I am going to explain to you as simply as possible how to program objects so that they seem to have a 3rd Dimension. I am not going to go into any kind of shading, filling, mapping etc. as this tutorial is for those who have never tried programming in 3D before. The more you know about Pascal the better the understanding of this tutorial, although I have tried to make this very easy to follow and understand by all. Why Pascal ? Well simply because Pascal is may main programming language, also Pascal is a good leader to the more popular languages of C and C++, where they are less structured and therefore harder to explain with. I will be using Pascal in all my examples, having a Pascal compiler (Turbo Pascal 7.0 for DOS is the best!) would be useful if you wish to learn from this tutorial.


The examples needed for this tutorial are below.

[Click To Download Example Archive - 3D.ZIP]

The examples themselves are only to illustrate the possibilities with the knowledge of how to write in 3D. This tutorial with give you the know how and therefore after going through this you should be able to do any type of 3D rotating and shading, with any objects you wish.

There are several ways in which programmers can make 3D objects, although the method that I am going to explain to you is not the absolute fastest (it is still very fast!) it is the most easiest to grasp and understand, and once you have got the idea, confidence and theory sorted on this method I am sure you will be able to work out other ways in which you can do the same task.

The Idea Behind The Theory.

The actual theory does include mainly maths, don't get put off now !! I will explain exactly what each bit does, and why we use it, but for you to truly understand and remember what 3D programming is all about, it will take your commitment to practice and practice.


Now the real theory know how - programming 3 dimensional objects is based on the theories of circles. (drawing them! Now you are confused! Read on.....)

How To Program In Three Dimensions

Firstly lets think about the drawing of a single pixel on a screen. The pixel has 2 co-ordinates, an X co-ordinate, and a Y co-ordinate.


Simply you would place the pixel N pixels along the horizontal line (X co-ordinate) and N pixels along the vertical line (Y co-ordinate), very simple. Put this information into a computer and the computer will display a pixel at those co-ordinates. BIG DEAL!!. But when you want something in 3D, that pixel or object of some kind, does not just have an X and Y co-ordinate, but also a Z co-ordinate, which represents the depth in which the pixel is (Not real !! but with the right know how you can make it seem to the computer user that the pixel has depth)

Getting the minus and plus signs right is important (you don't want the object to go the wrong way round ! :-( )
So now we know that every pixel or point must have an X, Y and Z co-ordinate, this does not automatically make the object 3D, now we need the maths.

Before we start the maths we need to consider what we are going to do with the objects, the different rotations. Both ways in each of the axis.

We need to work out a few mathematical sums so that we know where to move a point. This is what you need to know.

Pcos:=cos(angle * 2 * Pi / 360)
Where Pcos is a real number (obviously) and is positive representing the direction that we want to go around the axis. The angle is the amount of degrees that you wish to go around in one step (this is great while controlling with the mouse as you can read in the mouse movement and put in the angle depending on how much the mouse is moved (see GRID.PAS, F_INC.PAS, F.PAS and BOX.PAS for examples where I have done this!).

Ncos:=cos(-angle * 2 * Pi / 360)
Where again Ncos is a real number of a negative value.

Psin:=sin(angle * 2 * Pi / 360)
As like Pcos above.

Nsin:=sin(-angle * 2 * Pi / 360)
As like Ncos above.

These values can be worked at during the main part of the program, not just the initialisations. The Pascal compiler is pretty good, and even calculations like this can be done very quickly. Just see my examples as illustrations of how fast it is.

OK, so now we have done the angle calculations, we have to know how to rotate that point so that it seems (is) 3 dimensional.

Firstly all the points have to be initialised so that the X, Y, and Z co-ordinate has a value, with in a sensible range (play around with the figures and get to know what the range is best at)

Lets rotate the point around the X-axis. For this to work you need to think about what should be happening. Pick up a pen, hold it horizontally in front of your eyes, close one eye, put your finger in front of the pen and concentrate on the tip of your finger. Now rotate your finger around the pen, notice how the finger tip just seems to go up and down. That means that the Y co-ordinate must be changing (your finger is going up and down the Y-axis). Now look down onto the pen, and rotate you finger around the pen, notice that it is only moving forwards and backwards. This means that the Z co-ordinate is changing (your finger tip is moving forwards and backwards along the Z-axis). So for the rotation in the X-axis the pixels Y and Z co-ordinate will change. To work out to what they change to we use another very simple equation.

If you were looking down the +ve end of the X-axis, to rotate the point clockwise (positive) around the axis we will use.

NewY:=Pcos * Y - Psin * Z
NewZ:=Psin * Y + Pcos * Z

If you were looking down the +ve end of the X-axis, to rotate the point anti-clockwise (negative) around the axis we will use.

NewY:=Ncos * Y - Nsin * Z
NewZ:=Nsin * Y + Pcos * Z

To rotate in the Y-axis the Y co-ordinate will not change so as like before the X and Z co-ordinate will change.
If you were looking down the +ve end of the Y-axis, to rotate the point anti-clockwise (positive) around the axis we will use.

NewX:=Pcos * X - Psin * Z
NewZ:=Psin * X + Pcos * Z

If you were looking down the +ve end of the Y-axis, to rotate the point clockwise (negative) around the axis we will use.

NewX:=Ncos * X - Nsin * Z
NewZ:=Nsin * X + Pcos * Z

To rotate in the Z-axis the Z co-ordinate will not change so as like before the X and Y co-ordinate will change.
If you were looking down the +ve end of the Z-axis, to rotate the point anti-clockwise (positive) around the axis we will use.

NewY:=Pcos * Y - Psin * X
NewX:=Psin * Y + Pcos * X

If you were looking down the +ve end of the X-axis, to rotate the point anti-clockwise (negative) around the axis we will use.

NewY:=Ncos * Y - Nsin * X
NewX:=Nsin * Y + Pcos * X

Where the variable X, Y, and Z are the original X, Y, and Z values, and NewX, NewY, and NewZ are the new X, Y, and Z values for the point.

Now you have a point that can be moved in any axis, as many degrees as you want, CONGRATULATIONS, you are now programming in 3D. Not as hard as you originally thought it was going to be hey!!

Well to tell you the truth, you have not completely finished. If you where to do this now you will find that it is impossible to tell if the point was at the back of the screen or the front, and therefore you will not be able to tell which way the point is rotating, apart from the Z axis obviously.

Well to get around this all you need to do is use a bit of colour, like I did in my examples, GRID.PAS, F.PAS, and BOX.PAS. Just decrease the colour of the pixel, line, or point as the points Z co-ordinate gets further away from you, i.e. it becomes less, and increase its colour as it the Z value gets higher i.e. towards you.

Hint: You will notice how the 5CUBES demo makes the cubes look solid. Easy just don t display the lines of the box if there Z value is less than zero (cube faces are flat! ;-) ). There is a even better way. Below I have allowed you to download a program written in FPK-Pascal, one of the best if not the best Pascal 32bit compilers. Because of the old 64Kbyte limit is overcome in 32bit, the program below has been written to be able to load in 3D studio ASCII files, i.e. more complex objects than that of the previous examples. The code also incorporates write frame, solid and flat shading. Take a look once you have mastered the above algorithm.

[Click To Download Example Archive - 3DFPK.ZIP]
I have given a compiled version in case you do not have FPK Pascal. Bare in mind that this compiled program will only work on an Intel Processor as it has been optimised to use this type of processor.

Well that's about it !!, I can still be contacted by e-mail if you are still having troubles, or if you think that the tutorial was not explanatory enough (I tried to make as explanatory as possible, I am sorry if you can not still understand what I was waffling on about !)


In the example I have given you at the top of this web page, I have incorporated Z perspective. This gives any object a kind of fish bowl look. Work out how it is done in the source, you will then have a better understanding!!



01 January 1998 00:55 GMT+00:00    Posted By: Adam Saunders
Comments *NEW*

Too view and add comments, click on the article titles and scroll to the bottom of the page.

Twitter Updates
About This Blog

The e-home of Adam Saunders

These are the declassified opinions of Adam Saunders. I take no responsibility for the effect these opinions may have on you. Do not read with care...