Results 1 to 2 of 2

Thread: Encryptor/decrypter

  1. #1
    Join Date
    Mar 2007
    Posts
    937
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Encryptor/decrypter

    Problem:
    Need to design a program that can encrypt and decrypt messages stored in simple text files using a private key stored in a separate file. Software should also be able to allow the users to enter simple messages that either displays the encrypted or decrypted message. The encryption method should use a simple substitution method. It should be set out in the following format:

    Example (the "@" is the separator):
    @
    The character The Code End of line
    A @ 4gh EOL
    B @ 84!9 EOL

    Has to use the 256 ASCII character codes. The separator will be used to separate the character and its corresponding code.
    Here are the pseudocodes I have come up with:


    • Read any private key file
    separator = readline(file);
    while not EOF(file) do
    tempStr = readline(file);
    tempArr = split(separator, tempStr);
    matchArr += tempArr[0];
    substitutionArr += tempArr[1];
    endwhile;
    • Allow users to enter messages (by entering text or file)
    string1 = user input from textbox

    • Encrypt and decrypt messages
    Encrypting:
    string1: get input from other module;
    length: length of string1;
    While Counter < length do;
    string2 += substitute from subarray(character(counter) of string1)
    endwhille;
    Decrypting:
    string1 = get input from other module;
    Length = length of string1;
    while counter < length do;
    string2 += substitute from matcharray(character(counter) of string1)
    endwhile;
    • Display encrypted/decrypted message
    textbox = string1
    • Print encrypted/decrypted message
    print encrypt (string1);
    print decrypt (string1);

    Can anyone point out if anything wont work/any fixes.

    Cheers
    -Ashur
    Exam period.

  2. #2
    Join Date
    May 2011
    Posts
    46
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You are using the 256-ASCII characters so you would need to read the file as binary.

    What is the encrypted message suppose to look like? I see that you have different substitute lengths for each letter; 'A' is three characters long, and 'B' is four characters long. Will there be spaces in the message to denote a different character?
    Last edited by jerryt; 06-13-2011 at 08:44 PM.
    Need help with a problem?

    Email: jerryt.srl@gmail.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •