|
-
Jun 19th, 2002, 10:24 PM
#1
simple encription question
I am sure this question is simple so it should not take you smart guys long. I have some text in a RichTextBox1 and i want to turn each character(letter) into a number then i am going to add a number to it say "1" and then save it to a file as a long set of numbers, when i want to read the info the program will subtract the number "1" and then turn the corresponding number back into a letter(character) and put them back in the richtextbox1 does anyone know how to do this? or maybe an easier way to go about it in vb .net
THANKS!!!
-
Jun 20th, 2002, 02:19 AM
#2
This kind of encryption is very easy to crack.
The framework provides special classes for almost uncrackable encryption, including the rijndael algorithm, which is one of the best.
Have a look at the System.Security.Cryptography Namespace.
I think with VB.NET it is more easy to use the (good) build in encryption methods, then make one of your own.
I think you must be able to find some samples on the web. I haven't used these classes myself yet.
-
Jun 20th, 2002, 09:07 AM
#3
I know that it is easy
Yea i know that the original way that this would work would be easy to crack....but if i can figure out how to turn each caracter(letter) into a corresponding number or integer then (cause i love high level math) i could write an algorithm that would be very hard to crack.
If anyone knows how to turn each caracter into a srting then let me know thanks!!
-
Jun 20th, 2002, 09:39 AM
#4
I believe the Asc and Chr functions still work in Vb.NET.
-
Jun 20th, 2002, 09:43 AM
#5
Also the classes in the System.Text Namespace could be of help, especially the ASCIIEncoding Class.
The GetBytes method can convert a string into a byte aray.
-
Jun 20th, 2002, 10:54 PM
#6
???
O.k. if you could tell me how to pic on each little character in a string say for instance the string is "This is a test" what would the code look like to get each individual character
CODE:
for 0 to richtextbox1.text.lenght
something in here to get the first(t) then the next(h) then the next(i) and so on so forth....(s)...( )...(i)..(s)..( )...(a)...ect
next
what do i need to do to get each character one at a time if i new how to do that i think i could take it fromt here
thanks
-
Jun 21st, 2002, 02:02 AM
#7
I you want to split it into single characters, you need an array of chars, but I thought you wanted to make numbers out of them, so to turn a string intom an array of bytes, you could use something like this:
not tested, I don't have VB.NET installed were I am right now.
VB Code:
Dim AE as new System.Text.ASCIIEncoding
Dim MyString as String = "This is a test"
Dim bArr() as Byte
bArr() = AE.GetBytes(MyString)
bArr now contains the ASCII values for each character in the string (ranging from 0 to 255)
-
Jun 22nd, 2002, 06:19 AM
#8
VB Code:
Dim AE As New System.Text.ASCIIEncoding()
Dim MyString As String = "This is a test"
Dim AnotherString As String
Dim bArr() As Byte
bArr = AE.GetBytes(MyString)
' now the string "This is a test" is converted to an array of bytes
' so every character in the string is now a number between 0 and 255 in the array
' you can encrypt it now, and save it to file
' after reading it back from file, and decrypting it,
' you can convert the bytearray back to a string like this
AnotherString = AE.GetString(bArr)
MsgBox(AnotherString)
-
Jun 25th, 2002, 08:30 AM
#9
-
Jun 26th, 2002, 11:23 AM
#10
anouther question!
ok say that i wanted to take each member in the array and add a number to it like the number 1 or 2 and then save it like that and when i open the file to read it i would subtract whatever the number i added to each member of the array was and then convert it back to a string. How would i go about doung that?
thanks agian
-
Jun 30th, 2002, 06:49 PM
#11
Why don't you use the XOR operator, you can make a pretty good encripter/decripter if you have a good imagination.... I use it a lot when I want to encript data... if you make a good algoritm with it, it's won't be easy to crack at all....
-
Dec 17th, 2002, 01:57 AM
#12
Hyperactive Member
-
Dec 19th, 2002, 08:23 AM
#13
New Member
heres a good example of the RSA algorithm in .NET
http://www.planet-source-code.com/vb...=782&lngWId=10
I'm also the author of the code in this link,.
Best regards
Svein
-
Dec 20th, 2002, 01:36 PM
#14
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
|