|
-
Nov 6th, 2000, 12:12 PM
#1
Thread Starter
Junior Member
Ok I need to find out how to do an if statement that finds one letter in a word. then I need to know how to add that letter to a textbox with out earsing the text all ready in the box. please help with code.
Always let the Wookiee Win!
-
Nov 6th, 2000, 12:19 PM
#2
Frenzied Member
You need to get a letter from a word and add it to a textbox?
Code:
'this is a really simple example
Private Sub Command1_Click() 'add a commandbutton
Dim pos%, Mystr$
'If you need to find all occurances of one character place this in a loop... post if you need help with that
Mystr = "I am Jop!"
pos = Instr(1, Mystr, "o")
Text1.Text = Text1.Text & Mid(Mystr, pos, 1) 'add to text leaving all other characters intact, and only get one character.
End Sub
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 6th, 2000, 12:29 PM
#3
Thread Starter
Junior Member
ok but
I need to get the letter from a differnt text box.
Always let the Wookiee Win!
-
Nov 6th, 2000, 12:38 PM
#4
Thread Starter
Junior Member
let me say what it's for
it's for an encryption part of a program. I want it to take the word in textbox change each letter (like a=c and stuff like that) and put the new word in anouther text box. I should have said that in the first place sorry.
Always let the Wookiee Win!
-
Nov 6th, 2000, 12:54 PM
#5
Frenzied Member
Ouch, that'll be a real weak encryption then 
Check keda's site for a cool encryption algorithm (www.kedaman.com)
Anyway, if you really want to do that (copying each letter)
Code:
Private Sub BadEncrypt(txtU As String, txtE As TextBox)
dim tmp$
For x = 0 To Len(txtU)
tmp = Mid(txtU, x, 1)
'Do whatever you want with the character here!
'Ie:
'If Lcase(tmp) = "a" Then tmp = "c"
'but it's better to use a Select Case statement
txtE.Text = txtE.Text & tmp
Next x
End Sub
'Call it like
Private Sub Command1_Click() 'in a commandbutton
BadEncrypt(Text1.Text, Text2.Text)
End Sub
Have fun but I recommend a better algorythm
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 6th, 2000, 01:01 PM
#6
Thread Starter
Junior Member
yea i know
I know it's a weak encryption, but i don't plan to have peole trying to hack into my program.
Always let the Wookiee Win!
-
Nov 6th, 2000, 01:02 PM
#7
Frenzied Member
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 6th, 2000, 01:25 PM
#8
Hyperactive Member
How about using the Internet shopping method?
To encode the password do like that every "a" in it will be "45382" in the encryption and every "b" in the password will be "76433" and so on...
When the app decodes it every "45382" will be "a", every "76433" will be "b" and so on...
It will be hard but it will be a kickass encryption!
By the way, it's not just for you, anyone here can use my little method!
Nice, isn't it?
But you have to make sure that when it comes out in encoding "4538276433" so the app won't think that "d" will be "82764" but you can bypass that by making the app go through 5 characters at a time. I know it has something to do with "Mid" function.
Hope you can get any help for this coz I have no idea of doing this!
-
Nov 6th, 2000, 01:52 PM
#9
Thread Starter
Junior Member
thanks JOP
Yes it helped Jop THanks!!!!! And thanks for the idea Asaf_99.
Always let the Wookiee Win!
-
Nov 6th, 2000, 02:01 PM
#10
Frenzied Member
Encryption program
Here's a cool encryption program I got from someone (wish I could remember who...)
To try it out, paste the code into the form's code window. Put 3 text boxes and 2 command buttons on the form (keep the default names). Type some text into the first text box. Press command button 1 to Encrypt the text and display it in text box 2. Press command button 2 to Decrypt the text in text box 2 and display it in text box 3.
Not the most secure, but it works well.
Code:
Option Explicit
Public Function Encrypt(ByVal theText As String) As String
Dim i, i1 As Integer
Dim letter, s1, code1, a, finstr As String
For i = 1 To Len(theText)
letter = Mid(theText, i, 1)
a = Asc(letter)
a = (3 * a) - 1
If a < 10 Then
a = "0" & a
End If
If a < 100 Then
a = "0" & a
End If
finstr = finstr & a
Next i
code1 = finstr
For i1 = 1 To Len(code1)
s1 = s1 & Chr(Int(Mid(code1, i1, 1)) + 117)
Next i1
Encrypt = s1
End Function
Public Function DeCrypt(ByVal Text As String) As String
Dim code, s1, letter, lcode, finstr As String
Dim i, curi As Integer
Dim LLcode As Long
code = Text
For i = 1 To Len(code)
s1 = s1 & Asc(Mid(code, i, 1)) - 117
Next i
code = s1
For i = 1 To Int(Len(code) / 3)
curi = i * 3 - 2
lcode = Mid(code, curi, 3)
LLcode = Val(Int(lcode))
LLcode = (LLcode + 1) / 3
finstr = finstr & Chr(LLcode)
Next i
DeCrypt = finstr
End Function
Private Sub Command1_Click()
Text2 = Encrypt(Text1)
End Sub
Private Sub Command2_Click()
Text3 = DeCrypt(Text2)
End Sub
-
Nov 6th, 2000, 03:34 PM
#11
New Member
I know a friend of mine who has come up with an encription method that would take around 2billion years to crack with a supper computer it uses the same methods as the enigma in WW2 but alot of it has bin improved like the fact he uses 16 incription weels and the weels can move places as well Owch!
hehe Don't get too cocky or the irony gods will kick your but!
-
Nov 6th, 2000, 04:18 PM
#12
Addicted Member
Asaf_99 that's a nice nice idea however won't the number pattern give away how the encryption is working. I mean for example the letter E occures the most right well a hacker can then work out which code occures the most, the second most, the thired most etc and he is able to code a dycription program.
Try adding some funcky mad ass maths in it?
this should through him/her off a bit or even a key to code each char by, this sarts to really add depth to the encryption and makes it that more stonger.
-
Nov 7th, 2000, 03:19 AM
#13
New Member
Thats what the weels are for so no two charictors are the same, like e = & in one part and e = h in another thats why it's so hard to crack one of the extras that was put in was the fact that e could = e so you could thow them off more.. hehe
hehe Don't get too cocky or the irony gods will kick your but!
-
Nov 7th, 2000, 08:37 AM
#14
Hyperactive Member
Yeah well, a math thing can be cool, like every letter will be added. Like in the encoding part "a" is 29653 and "b" is 67473 and when you encode it you will have a+b=97126 you will break it apart.
However, how will the hacker see the incoded password? he doesn't see it and only the pc itself will. Nothing can take a look of a string (or any other variable) which is in another program which not built to "serve" any other running application.
-
Nov 7th, 2000, 11:40 AM
#15
New Member
You don'tsend the key with the message this is how it works...
Message --> Encript with key:"Blah"
Encripted Message without key --> send to reader
ReaderEncripts Message with Key:"halB"
Double Encripted message gets sent back to
creator the creator then decripts the message with "Blah"
then the decripted-encripted message is sent back to
the reader the reader decripts eith the key:"halB" and hey
presto a readable message, nether of the keys were sent
and the message than travles would take billions of years to decript haha lets see our hackers get past that!
hehe Don't get too cocky or the irony gods will kick your but!
-
Nov 7th, 2000, 03:02 PM
#16
Addicted Member
DoctorMO how would the double encrypted message be decoded if the top encryption is covering the underlaying one?
Doesn't the top encrytion need to be removed first?
-
Nov 7th, 2000, 03:50 PM
#17
Frenzied Member
Check this out for more info...
-
Nov 8th, 2000, 03:25 AM
#18
New Member
I have known about that incription method but have never tryed to use it in VB were as the one above I have used as a feature in an e-mail program.
hehe Don't get too cocky or the irony gods will kick your but!
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
|