Results 1 to 6 of 6

Thread: VB6 Encryption & Decryption

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2017
    Posts
    3

    Unhappy VB6 Encryption & Decryption

    Hi Members of VB forums,

    I am new in the VB6 developping, and i am from a french spoken country so excuse my english if it's bad.
    i came wanted to build a little program that can do encryption and decryption in VB6 and Asp but i have some problems to make it work. the promgrams uses ASCII switch to mixed caracters just like it is shown here : http://www.sourcecodester.com/tutori...using-vb6.html
    Code:
            Private Sub Command1_Click()
            Text2.Text = Encrypt(Text1.Text, Len(Text1.Text))
        End Sub
         
        Public Function Encrypt(Name As String, Key As Long) As String
        Dim v As Long, c1 As String, z As String
            For v = 1 To Len(Name)
                c1 = Asc(Mid(Name, v, 1))
                c1 = Chr(c1 + Key)
                z = z & c1
            Next v
            Encrypt = z
        End Function
         
        Private Sub Command2_Click()
            Text2.Text = Decrypt(Text2.Text, Len(Text1.Text))
            Text1.Text = ""
        End Sub
         
        Public Function Decrypt(Name As String, Key As Long) As String
        Dim v As Long, c1 As String, z As String
            For v = 1 To Len(Name)
                c1 = Asc(Mid(Name, v, 1))
                c1 = Chr(c1 - Key)
                z = z & c1
            Next v
            Decrypt = z
        End Function
    but i want to use my own encryption that will give :

    123456789 = Qj>:i5&F:LaGYXuyxr

    abcdefghij = Luvwi5zn>:Kw?6wtg:,,

    0123456789 = A/uy&Fi5&F:LaGYXuyxr

    1234567890 = ZV=?d@D)|i3kBo(l/e>a

    i have seen from some websites that the encryption and decryption goes like here :
    Code:
    function encrypt(ecode)
    Dim texts
    dim i
    for i=1 to len(ecode)
    texts=texts & chr(asc(mid(ecode,i,1))+i)
    next
    encrypt = texts
    end function 
    
    function decrypt(dcode) 
    dim texts
    dim i
    for i=1 to len(dcode)
    texts=texts & chr(asc(mid(dcode,i,1))-i)
    next
    decrypt=texts
    end function
    
    function mistake(preString)
    Dim texts
    Dim seed
    Dim i,length
    prestring = trim(preString)
    length = len(preString)
    seed = length
    Randomize(length)
    texts = ""
    for i = 1 to length
    seed = int(94*rnd(-asc(mid(preString,i,1))-seed*asc(right(prestring,1)))+32)
    texts = texts & chr(seed) & chr(int(94*rnd(-seed)+32))
    next
    dim dist
    dist=""
    for i = 1 to len(texts)
    if mid(texts,i,1)<>"'" then
    dist=dist+mid(texts,i,1)
    end if
    next 
    mistake = dist
    end function
    So i am asking how can i put this into the codes i post above that will give encryption and decryption into a text box in vb6 so that when i type '123456' it will give this 'Nqo(&FZV|ixr' in the encrypted text box, and when i click decrypt it will give the '123456'
    I have tried but now luck.
    i am a computer techncian and i am new into programmming stuffs. any help is welcome
    Thanks.
    Last edited by Shaggy Hiker; Apr 24th, 2017 at 05:02 PM.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,039

    Re: VB6 Encryption & Decryption

    Welcome to the forum. I edited your post to add CODE tags. To do this yourself, just press the # button and paste your code between the [CODE][/CODE] tags.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2017
    Posts
    3

    Re: VB6 Encryption & Decryption

    it does not work, i have tried it and it does not work. any help please?

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2017
    Posts
    3

    Re: VB6 Encryption & Decryption

    any help will be welcome. i Just want to do this encryption and decryption prog so that when i type into a text box in vb6 '123456' it will give this 'Nqo(&FZV|ixr' in the encrypted text box, and when i click decrypt it will give the '123456'
    The encryption and decryption code is shown above.

  5. #5
    Hyperactive Member
    Join Date
    Aug 2006
    Location
    TeXaS
    Posts
    497

    Re: VB6 Encryption & Decryption

    Quote Originally Posted by aquriuz81 View Post
    any help will be welcome. i Just want to do this encryption and decryption prog so that when i type into a text box in vb6 '123456' it will give this 'Nqo(&FZV|ixr' in the encrypted text box, and when i click decrypt it will give the '123456'
    The encryption and decryption code is shown above.
    Where are you getting the comparison value of 'Nqo(&FZV|ixr' ? It seems you are wanting us to break another encryption that is already present somewhere else. A normal programmer is not going to be able to just make an encryption program that jumbles 123456 to Nqo(&FZV|ixr. Although I haven't broke down the data myself for your comparison, I would assume it would possibly take much time/effort to recreate it, and even doing so would not be likely to recreate all the entries you have provided in the same algorithm. maybe if someone knew where you got the original data, they could find out what cypher the program is using and possibly link you something that is already written for it.

  6. #6
    New Member
    Join Date
    May 2017
    Posts
    2

    Re: VB6 Encryption & Decryption

    Here is a text encryption program to beat all others!

    https://www.dropbox.com/s/dq4fcp72yc...02017.zip?dl=0

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