 |
 |

03-31-2012, 03:10 AM
|
|
Newcomer
|
|
Join Date: Mar 2012
Posts: 8
|
|
Need Help with my project [Encrpyting program]
|
Hi guys, I'm currently in year 12 and I received my major project for this year and I have no ideas how to code program  . Please help, it dues in the next four weeks. Question is attached! ( no viruses  )
Thanks guys 
|
|

03-31-2012, 05:22 AM
|
 |
Contributor
|
|
Join Date: Oct 2003
Location: Pennsylvania
Posts: 422
|
|
|
I see your project, however I will not do it for you. Neither will others here. This is not your first project so exactly what is your stumbling point? Show what you have written so far.
|
|

04-08-2012, 03:59 AM
|
|
Newcomer
|
|
Join Date: Mar 2012
Posts: 8
|
|
|
I'm so sorry for this very late reply, I haven't done anything because I wasn't good at coding but here's what I wonder: Assuming that I already have a private key file which contains ASCII codes, how am I going to code the Open button to whether load the private key file and load the user's messages to the program
Here is my screen design (I was very stupid because I forgot to create another Load button to load my private key file, so now I have to code for the Open button to whether load the private key file and load the user's messages)
|
|

04-08-2012, 06:19 AM
|
 |
Contributor
|
|
Join Date: Oct 2003
Location: Pennsylvania
Posts: 422
|
|
|
Show some code as to what you have done so far and lets see where you are having the issue. Generally a simple way to encrypt is to just 'XOR' the values to encrypt and then 'XOR' the values again to return the original value.
|
|

04-08-2012, 07:32 AM
|
 |
Bald Mountain Survivor
Super Moderator * Expert *
|
|
Join Date: Aug 2003
Location: Oregon, USA
Posts: 5,917
|
|
|
soloko2412,
This is a teaching forum. We wll not do your homework for you. You have to make an effort to read and understand the material.
On the other hand.
If you have a specific question such as "how do I read text from a file?" We can point you to tutorials on the topic or if you post code you have written we can help you correct it. We can also explain how programming works at a general level so you can build your knowledge on a good foundation.
|
__________________
Burn the land and boil the sea
You can't take the sky from me
~T
|

04-10-2012, 05:19 AM
|
|
Newcomer
|
|
Join Date: Mar 2012
Posts: 8
|
|
Hi guys, I didn't ask you to code all the functions for me so don't be misunderstanding  .
I'm so stuck and I don't even know where to begin: When I click the Open button, firstly It will load the private key file, secondly it will load the user's message. And then using that private key file which is loaded, to encrypt user's message T_T, I JUST NEED SOME IDEADS
|
|

04-10-2012, 11:48 AM
|
 |
Contributor
|
|
Join Date: Oct 2003
Location: Pennsylvania
Posts: 422
|
|
Quote:
Originally Posted by soloko2412
Hi guys, I didn't ask you to code all the functions for me so don't be misunderstanding  .
I'm so stuck and I don't even know where to begin: When I click the Open button, firstly It will load the private key file, secondly it will load the user's message. And then using that private key file which is loaded, to encrypt user's message T_T, I JUST NEED SOME IDEADS
|
Looks like you have the idea. Lets say the key is "29 43 21 08 16 05" and the message is "The quick brown fox jumps over the lazy dog"
When you click open and the user's message and key displays like my example, you could add the keys together and then XOR each letter in the message one at a time to the key sum. Then display the encrypted message.
To decode, use the same key and just XOR the encrypted message one letter at a time to return it to normal.
|
|

04-12-2012, 04:50 AM
|
|
Newcomer
|
|
Join Date: Mar 2012
Posts: 8
|
|
|
Thank you!
I solved the easiest thing in the program which is Open the private key file and user's message and now I'm up to creating the private key file and I have no ideas how to format it.
My assessment says: "The encryption method should use a simple substitution method. It should be set out in the following format."
The Character - Space - The code - EOL
A - Space - 4Gh - EOL
So I opened notepad I've been staring at it without knowing what I'm doing. Please help!
|
|

04-13-2012, 04:53 AM
|
 |
Contributor
|
|
Join Date: Oct 2003
Location: Pennsylvania
Posts: 422
|
|
|
Well if your key is a number lets say 3, you could find the asc value of each character and add the key to the value then convert the value back to the character.
if you have the message "car"
The asc value of the letter "c" is 67 so add the key which is three to 67 we get 70. which is the letter "f"
c = f
a = d
r = u
That is just one simple possibility.
You also could pre generate an array of substitutional values you wish to access.
|
|

04-15-2012, 03:20 AM
|
|
Newcomer
|
|
Join Date: Mar 2012
Posts: 8
|
|
I understand what you're trying to say but the point is how do I type (format) the ascii codes into Notepad? Because the program requires its user to load the private key file which is created as *.txt. I've one example, can you please check it, I appreciate 
|
Last edited by soloko2412; 04-15-2012 at 03:48 AM.
|

04-15-2012, 08:29 AM
|
 |
Bald Mountain Survivor
Super Moderator * Expert *
|
|
Join Date: Aug 2003
Location: Oregon, USA
Posts: 5,917
|
|
|
The simplest of substitution encryptions is to swap each letter in a sentence for another fixed letter.
A N
B E
C L
...
"CAB" would be encrypted as "LNE"
Filling your text file with each letter of the alphabet and a scrambled list of the same letters would fullfill the requirement just as I've shown above.
If you read them from the file into a 2D array you will have a look up table for converting to and from an encryption.
If you read each line of file text into a string variable using the LINE INPUT statement you can get the leftmost character by using
LEFT(<string variable>,1) and the rightmost character by using
RIGHT(<string variable>,1) .
To step through each letter in a sentence you would use the Mid() function in a loop.
---
There is a simpler way to do the look up if you use the ASC() function but perhaps your instructor is saving that for a later lesson.
|
__________________
Burn the land and boil the sea
You can't take the sky from me
~T
Last edited by Gruff; 04-15-2012 at 08:52 AM.
|

04-15-2012, 02:00 PM
|
 |
Sinecure Expert
Super Moderator * Guru *
|
|
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,722
|
|
|
I'm pretty sure the instructor gave fairly detailed requirements for the program, so that the instructor can feed a key file and process messages through the system to see if it produces the specified result.
All the "help" you've been given so far have been different approaches to encrypting a file, and look up table and if you implemented any of them will no likely get a low score on the project.
The project, as defined by the instructor, is more complicated than any of the suggestion.
Any single unencrypted letter input can produce a variable number of characters output.
The brief example in the pdf file shows two characters being encoded with 3 characters and a third encoded with 4 characters.
Using a variable number of output characters for an input character makes it harder for someone to break since (assuming they don't have access to the "key" file"), won't know how many characters are in your original string, or where the "character" boundries are in the encrypted string, since the number of characters in the encrypted character is variable.
That also make is harder on you to decode an encrypted string, since you have to compare a number of characters against your key list to find a match.
Also, if any of your keys for a given character are a subset of the key for another letter, that can be an issue as you may get a match on the shorter key and choose that letter, rather than choosing the longer key that may be found later.
When decoding, you may have to try all keys at each spot, and if you get more than one match, either choose the longer match, if you know the keys are unique enough that no possible two letter combinations will combine to produce a sequence that would produce a substring that would match a key for a single character.
Or you may have to keep the multiple matches, and try each "branch" to see if you eventually find a branch that doesn't decode, so eliminate it.
The project sounded initially a bit simple for a major year 12 project, but looking at the actual requirements show that it is worthy.
|
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
|

04-15-2012, 02:22 PM
|
 |
Underclocked lifestyle
Forum Leader * Guru *
|
|
Join Date: Feb 2005
Location: Michigan, USA
Posts: 4,193
|
|
|
Since the requirements are to use Pascal, VB.Net 2008, or some open sores compiler I'm wondering why this thread is continuing in a Classic VB forum instead???
I suspect whoever wrote that meant to say "free" compiler, but it is amazing how clueless people can be.
|
|

04-15-2012, 08:26 PM
|
 |
Sinecure Expert
Super Moderator * Guru *
|
|
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,722
|
|
Quote:
Originally Posted by dilettante
Since the requirements are to use Pascal, VB.Net 2008, or some open sores compiler I'm wondering why this thread is continuing in a Classic VB forum instead???
I suspect whoever wrote that meant to say "free" compiler, but it is amazing how clueless people can be.
|
I suppose you're right.
The compiler being used wasn't specified, so could be put in Misc languages or the .Net side.
The Form definitely looks like .Net, so .Net it will be.
|
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
|

04-16-2012, 09:47 AM
|
 |
Bald Mountain Survivor
Super Moderator * Expert *
|
|
Join Date: Aug 2003
Location: Oregon, USA
Posts: 5,917
|
|
|
Ah well I don't remember seeing that pdf attachment in the original post.
That information does change things.
|
__________________
Burn the land and boil the sea
You can't take the sky from me
~T
|

04-18-2012, 04:01 AM
|
|
Newcomer
|
|
Join Date: Mar 2012
Posts: 8
|
|
Well thank all you guys, I don't know how to show my appreciation  . This project importantly counts to my ATAR (mark I have to get to get into uni) so the next part I'll try to do it. But before I get away, I have two more last question, I've been asking several people about which computing languages I should learn nowadays and they said: Net and Java and some even said "Don't study, it's too late :|". What do you guys think?
And second last question is: In my project, how do I code the part where the user encrypt their message after the private key file has been loaded (Just give me ideas and examples)
|
|

04-18-2012, 09:55 AM
|
 |
Sinecure Expert
Super Moderator * Guru *
|
|
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,722
|
|
Quote:
Originally Posted by soloko2412
... some even said "Don't study, it's too late :|". What do you guys think?)
|
In the late 70's or very early 80's, I had mentioned to my father at some point that I would like to get a job programming computers when I got out of the Navy. He talked with a programmer (probably COBOL) at his work which was a major Furniture manufacturer.
The programmer told him that programming was going to be a dead end soon and there was not much of a future to it. Soon you would be writing requirements in some high level manner and the computer would produce the code to be run, so programmers would no longer be necessary.
Fortunately, I like programming for the sake of programming, not just as a way to make money, so I continued anyway and have been pretty much writing software for over 30 years now, and it still pays the bills.
I don't think the age of the software writer is going to be gone any time soon.
Quote:
Originally Posted by soloko2412
...how do I code the part where the user encrypt their message after the private key file has been loaded (Just give me ideas and examples)
|
That seem's obvious, but if not obvious then the question must be vague.
If the encrypt option is selected, then you should use the StringBuilder class, since it is made to buildup a string efficiently, to collect the encryption characters.
You would loop through the source string character by character, looking up the encryption key for that character and (using the StringBuilder class) append that key to your output string.
Once all the input characters are processed. Convert the StringBuilder string object to a regular string and display it in your output window, and save it, or whatever else you need to do with it.
The trickier part, it seems to me, is the reverse case where given a jumble of characters, finding the variable length keys to convert back into a single character. If you can guarantee that no shorter key matches the start of any longer key, then it shouldn't be that difficult since you can just compare the keys against the current sequence, but if that is not guaranteed, then you will have to compare all keys to see if you have duplicate matches, then find a way to resolve them.
|
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
|

04-19-2012, 03:08 AM
|
|
Newcomer
|
|
Join Date: Mar 2012
Posts: 8
|
|
Thank man  . I think I will learn NET
Well, I don't think these above questions are the last questions  ). I just recognized one error: I use StreamReader to load the private key file and user's message simultaneously so once the user clicks Open, the message and the private key file will be displayed simultaneously on its own text box/listbox but the thing is if a user types the message and then click Open to load the private key file, it will be an error.
|
Last edited by soloko2412; 04-19-2012 at 03:13 AM.
|

04-19-2012, 09:07 AM
|
 |
Bald Mountain Survivor
Super Moderator * Expert *
|
|
Join Date: Aug 2003
Location: Oregon, USA
Posts: 5,917
|
|
|
soloko,
We cannot troubleshoot a problem by loose description alone.
Our hands are tied until you start posting the code with which you are having problems.
|
__________________
Burn the land and boil the sea
You can't take the sky from me
~T
|

04-19-2012, 09:30 PM
|
|
Newcomer
|
|
Join Date: Mar 2012
Posts: 8
|
|
Sorry I forgot:
Code:
PrivateKey = New IO.StreamReader("C:\" & txtMessage.Text & "privatekey.txt")
While (PrivateKey.Peek() > -1)
lsbPrivateKey.Items.Add(PrivateKey.ReadLine)
End While
PrivateKey.Close()
Message = New IO.StreamReader("C:\" & txtMessage.Text & "user.txt")
While (Message.Peek() > -1)
txtMessage.Text = Message.ReadToEnd()
End While
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|