Results 1 to 18 of 18

Thread: NewBE question

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    The Glove state
    Posts
    28

    Question

    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!

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    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.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    The Glove state
    Posts
    28

    Talking ok but

    I need to get the letter from a differnt text box.
    Always let the Wookiee Win!

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    The Glove state
    Posts
    28

    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!

  5. #5
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    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.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    The Glove state
    Posts
    28

    Talking 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!

  7. #7
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Oh ok, did it help?
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  8. #8
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335
    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!
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    The Glove state
    Posts
    28

    Exclamation thanks JOP

    Yes it helped Jop THanks!!!!! And thanks for the idea Asaf_99.
    Always let the Wookiee Win!

  10. #10
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Thumbs up 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
    ~seaweed

  11. #11
    New Member
    Join Date
    Nov 2000
    Location
    UK Liverpool
    Posts
    10

    Talking

    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!

  12. #12
    Addicted Member Ramandeep's Avatar
    Join Date
    Feb 2000
    Posts
    158
    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.

  13. #13
    New Member
    Join Date
    Nov 2000
    Location
    UK Liverpool
    Posts
    10

    Red face

    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!

  14. #14
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335
    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.
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  15. #15
    New Member
    Join Date
    Nov 2000
    Location
    UK Liverpool
    Posts
    10

    Talking

    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!

  16. #16
    Addicted Member Ramandeep's Avatar
    Join Date
    Feb 2000
    Posts
    158
    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?


  17. #17
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Talking Check this out for more info...

    Here's a cool (short) blurb on Public key encryption from Webopeadia:

    http://webopedia.internet.com/TERM/p...ptography.html
    ~seaweed

  18. #18
    New Member
    Join Date
    Nov 2000
    Location
    UK Liverpool
    Posts
    10

    Talking

    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
  •  



Click Here to Expand Forum to Full Width