Question: Create a message encryption system application that translates every message character to its ASCII equivalent and pads the resultant code with a chosen random key based on an addictive operation.

program Encrypt;
   type tab=array[1..255] of byte;
 function Sum(T:tab):integer;
     var i,s:integer;
     for i:=1 to length(T) do

        s: string;
        ascii: array [1..255] of byte;
        i,code: integer;

        write('Enter a string: '); readln(s);
        for i:=1 to length(s) do

{ s[i] accesses each element of the string as a char.
        ord returns the ASCII value of the char. }

        writeln('ASCII vals: ');
        for i:=1 to length(s) do
                  { Generate a random key }
                writeln('the random key is : ',code);

                writeln('the encrypted message  is :',sum(ascii)*code);

After showing this to him, he said i should use Lazarus to create the application and use A menu that can allow me choose to input a string and then encrypt it. I have tried it on Lazarus but failed and i dint understand the menu. please i need help, Its a assignment.

Edited 11 Months Ago by David_65

That question looks like an assignment so go ahead and put your question in another reply.

My question is: "What is this addictive operation?"

First, write out the solution (as you understand it) in pseudo-code. IE, plain language describing the problem and solution. Then, we may be able to help you put it into code. Do bear in mind that Pascal is an ANTIQUE language (Niklas Worth wrote it in the 1960's or 70's as a teaching language). He went on to write Modula, a much more complete programming language. FWI, my good friend Bruce Ravenel was a graduate student of Worth back when before Bruce went to work for Intel and became one of the 2 principal designers of the 8086/8087 processor families...

I can send you a copy of Bruce's IEEE article (published in 1970) "Toward a Pascal Standard", but it is over 4MB so I will need a real email address for you, which you can send me via Daniweb in-mail.

rProffitt= My question is how do i intepret it on Lazarus source editor, i have created the form. For the addictive operation, is what i also dont understand.

Also, that should have been Niklas Wirth, not Worth... Doh! And to think, I have a couple of his books on my shelf! Stupid keyboard!

Edited 11 Months Ago by rubberman

This article has been dead for over six months. Start a new discussion instead.