|
-
Feb 2nd, 2000, 01:11 AM
#1
Thread Starter
Hyperactive Member
Ok I will email you later cause my email is down right now and it should be up in like a couple of hours stupid I hate when it crashes
------------------
Sincerely,
Chris
:-) ;-)
just have fun out there and live life to the fullest while it is still here
Email [email protected]
-
Feb 2nd, 2000, 01:47 AM
#2
Frenzied Member
I think this is what NetSurfer was talking about...here is a simple program to demonstrate the encoding/decoding of a line of text.
Create a form with three text boxes on it (text1, text2, and text3). Then paste the following code into the form's code module.
To use the program, type something into text1. The program reads each key you type in and subtracts 7 from the ascii value of that character, and then prints that character in text2. Then text3 takes the rightmost character from text2, adds 7 to its ascii value, and prints the resulting character. (text1 has your original message, text2 has the encoded message, and text3 has the decoded message).
Hope this helps a little!!!
Here's the code:
Code:
Option Explicit
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii >= 33 And KeyAscii <= 126 Then
Text2 = Text2 & Chr$(KeyAscii - 7)
Text3 = Text3 & Chr$(Asc(Right$(Text2, 1)) + 7)
Else
Text2 = Text2 & KeyAscii
Text3 = Text3 & Right$(Text2, 1)
End If
End Sub
[This message has been edited by seaweed (edited 02-02-2000).]
-
Feb 2nd, 2000, 01:52 AM
#3
Junior Member
USE THE TUTORIAL ON THIS SITE....YOU KNOW THE ONE WITH THE BIG SIGN SAYING "DATABASE TUTORIAL" I FOUND IT QUITE USEFULL
RHYS
-
Feb 2nd, 2000, 02:09 AM
#4
Hyperactive Member
Seaweed is right, that's basically what I meant except for the wrapping around 126 and 33. But that could be optional.
-
Feb 2nd, 2000, 03:38 AM
#5
Frenzied Member
Ok...check this out, guys...
This time I wrote the code with the "wrapping" feature so the ascii value is always between 32 and 146 (like NetSurfer suggested),
AND (here's the good part)...
I used a variable to hold the value for the amount to adjust the ascii value. This way, you can periodically change this value when encrypting as long as you know exactly when and how much to change it when decrypting.
In other words, you can increment the value every 5th character as long as you do the same when decrypting. This should make it harder for someone to decrypt (the old way they would just have to figure one number and they could decode the whole message).
I tested it a little, and it seems to work for values from -120 to 65!! That's a good range to work with, I'd say.
Try it out and see if it works for you!!
~seaweed
Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim ChangeAmt As Integer
ChangeAmt = -120 'This can be any number from -120 to 65
If KeyAscii >= 32 And KeyAscii <= 146 Then
If KeyAscii - ChangeAmt < 32 Then
Text2 = Text2 & Chr$(147 - (32 - (KeyAscii - ChangeAmt)))
Else
Text2 = Text2 & Chr$(KeyAscii - ChangeAmt)
End If
If Asc(Right$(Text2, 1)) > 146 - ChangeAmt Then
Text3 = Text3 & Chr$(32 + ((147 - ChangeAmt) - (Asc(Right$(Text2, 1)))))
Else
Text3 = Text3 & Chr$(Asc(Right$(Text2, 1)) + ChangeAmt)
End If
Else
Text2 = Text2 & KeyAscii
Text3 = Text3 & Right$(Text2, 1)
End If
End Sub
[This message has been edited by seaweed (edited 02-02-2000).]
[This message has been edited by seaweed (edited 02-02-2000).]
-
Feb 2nd, 2000, 12:47 PM
#6
Thread Starter
Hyperactive Member
WEll now that I got you here please listen. Umm say you have an ini file and you don't want anybody to go into the ini file and so you could you name it myini.ini.??? anything or this way myini.???.ini and would that make it so that the people can't open but vb can still write to it and read from it? Thanks!! Oh and please don't say use a database and also does anyone know of any good database tutorials?
------------------
Sincerely,
Chris
:-) ;-)
just have fun out there and live life to the fullest while it is still here
Email [email protected]
-
Feb 2nd, 2000, 12:53 PM
#7
You can name it anything you want, using an unknown extension will prevent the file from opening in Notepad, etc, but the User could still look at it by making an association with Notepad or Opening it from Within an Application like Notepad.
If you really don't want the end user to see what's in the file, encrypt it.
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Feb 2nd, 2000, 12:55 PM
#8
Thread Starter
Hyperactive Member
Well how would you go about encrypting it?
------------------
Sincerely,
Chris
:-) ;-)
just have fun out there and live life to the fullest while it is still here
Email [email protected]
-
Feb 2nd, 2000, 12:58 PM
#9
Hyperactive Member
I'm not sure how to make it a file they can't edit but one thing you could do is encode it yourself.
Not sure how big your ini file is, but instead of using the API to read/write it, do it manually but replace all the ascci codes with a different one. For example, if it's between 32 and 126, add or subtract a set value. Say you decide to use 7. Then when reading from the INI file, add 7 to the value, when writing to it, subtract 7. Make sure that if subtracting or adding 7 won't put it out of the 32/146 bounds. If it does, you'd have to take the remaining difference and tack to the other side so that it would wrap from 32 to 146. IE: If the ascci was 35, subtracting 7 would be 28 which is 4 too far so it would be 146 - 4 = 142. Its' not a quick way or anything but it's kinda fun to do :-)
If you're not sure what I mean, I made an app awhile ago that would let you type something and then display the encrypted value. It was pretty simple. If you want it, email me and I will send it to you when I get home.
[This message has been edited by netSurfer (edited 02-02-2000).]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|