Results 1 to 9 of 9

Thread: My school project!

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    3

    My school project!

    I received a new major project from my school creating a software which will be used to encrypt and decrypt messages stored in a simple text files using a private key stored in a separate file. The software should also be able to allows the users to enter simple messages that either displays the encrypted or decrypted message. (Use ASCII code)

    I just finished the design of the program. It's including two buttons which are encrypt and decrypt, a text box which allows the user to enter messages or load file into it, a listbox which allows the users to load the private key file (ASCII Code). My problem is I don't how to create that private key file.

    Please help me out with this, thanks

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Dunmow,Essex,England
    Posts
    898

    Re: My school project!

    I'm not going to give you the answer, but here's a pointer. go to Project/references and make a reference to the FileSystemObject. Once referenced you will have create files, directories, read and write at your disposal

  3. #3
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: My school project!

    Personally I would use the built in file functions rather than the FSO but that's me.

    IF it is not a requirement that the private key be created by your program then you could use a text editor like notepad to create a key that contains only typeable characters or a hex editor to make one that includes non typeable characters. You could course also create any type you want through code using the standard Basic file functions.

  4. #4
    PowerPoster Code Doc's Avatar
    Join Date
    Mar 2007
    Location
    Omaha, Nebraska
    Posts
    2,354

    Re: My school project!

    So, write your own encryption and decryption routine. Then toggle back and forth within the textbox to show the encrypted and original text.

    Seems simple enough. Go for it. I wrote one of these fifteen years ago and it worked.
    Doctor Ed

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    3

    Re: My school project!

    Thanks for your help guys, but what makes me still confused is the ASCII character code consists of 256 characters, how am I gonna create the private key or I just sit there and type ?

  6. #6
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: My school project!

    The base ASCII code set is 128 characters. Extended ASCII brings it up to 256

    A key is just a group of characters could be just a few characters or a lot of characters depending on the routine you are using. If the goal is to write your own routines to do this then it is up to you what you use as the key.

  7. #7
    Addicted Member
    Join Date
    Jun 2010
    Location
    The Keystone State
    Posts
    131

    Re: My school project!

    Well you could loop thru the unencrypted message one character at a time. Grab it's ASC value, add three to it and save the new character as encrypted message character. Then for decryption, do the same thing except subtract three from the value.

    "A" = 65 ASC value so when you add three to it, it becomes ASC value 68 which is "D".

    This is very easy to break but it will encrypt your message. the "KEY" is the addition or subtraction of a value.

    ...

    Another way is to "XOR" each character's ASC value.

  8. #8
    PowerPoster Code Doc's Avatar
    Join Date
    Mar 2007
    Location
    Omaha, Nebraska
    Posts
    2,354

    Re: My school project!

    Quote Originally Posted by B61Nuke View Post
    Well you could loop thru the unencrypted message one character at a time. Grab it's ASC value, add three to it and save the new character as encrypted message character. Then for decryption, do the same thing except subtract three from the value.

    "A" = 65 ASC value so when you add three to it, it becomes ASC value 68 which is "D".

    This is very easy to break but it will encrypt your message. the "KEY" is the addition or subtraction of a value.

    ...

    Another way is to "XOR" each character's ASC value.
    That "add 3" idea works most of the time but if the existing ASC exceeds 125, you will get an Illegal Function Call error. That can be avoided if you take all existing ASC values below 129 and add 128 to them. Then subtract 129 from all existing ASC values from 129 to 256.

    Next, all you have to do is make sure that your code doesn't get used in China, Korea, India, or Singapore. It will likely fail.
    Last edited by Code Doc; Feb 25th, 2012 at 08:54 PM.
    Doctor Ed

  9. #9

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    3

    Re: My school project!

    I forgot to tell the format of the code:

    The Character The Code End of line
    A Space 4Gh EOL
    B Space 8%9 EOL
    The Character: A - Space; The Code: 4Gh; End of line: EOL
    The Character: B - Space; The code: 8%9; End of line: EOL

Posting Permissions

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



Click Here to Expand Forum to Full Width