Results 1 to 2 of 2

Thread: Please help anyone help help encrytion!!

  1. #1

    Thread Starter
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Post

    I have 4 textboxes the 1st is the one you type in and then you hit a command button and it encrypts it fine into the 2nd text box then it writes to an ini fine with the coded string. (with out shutting down the program) but then when i hit the second command button it will read it and put it in the 3rd text box all encryted but when it decrypts it it in the 4th text box it gives me the cryted and uncrypted string in one. but if the program shuts down and then i hit the second command button it will put the crypted string in the 3rd text box fin and it willl decrypt it fine in the 4th text box. here is the code
    Option Explicit
    Dim strtemp As String, strtemp2 As String, intI As Integer, intAsc As Integer
    Dim strtemp1 As String
    Private Sub Command1_Click()
    If Text1.Text <> "" Then
    For intI = 1 To Len(Text1.Text)
    strtemp = Asc(Mid(Text1.Text, intI, 1))
    If strtemp >= 111 Then 'If add 15 then it puts the ascci outside the contraints
    strtemp = CInt(strtemp) - 92 'this sets it to a value below 33 to add 15 to
    End If
    intAsc = CInt(strtemp) + 15
    strtemp2 = strtemp2 & Chr(intAsc)
    Next intI
    Text2.Text = strtemp2
    Text1.Text = ""
    ret = WritePrivateProfileString("Happy", "Sara", strtemp2, "C:\myini.ini")
    End If
    End Sub

    Private Sub Command2_Click()
    ret = GetPrivateProfileString("Happy", "Sara", "C:\myini.ini", Temp, Len(Temp), "c:\myini.ini")
    Text3.Text = Trim(Temp)
    If Text3.Text <> "" Then
    For intI = 1 To Len(Text3.Text)
    strtemp1 = Asc(Mid(Text3.Text, intI, 1))
    If strtemp1 <= 46 Then 'If subtract 15 then it puts the ascci outside the contraints
    strtemp1 = CInt(strtemp1) + 92 'this sets it to a value below 33 to add 15 to
    End If
    intAsc = CInt(strtemp1) - 15
    strtemp2 = strtemp2 & Chr(intAsc)
    Text4.Text = strtemp2
    Next intI
    End If
    End Sub

    so for example if i put in chris in first it will crypt it to Rw%x& and write the ini but then without shutting it down i decrypt it and in the 3rd text box i get Rw%x& and in the 4th i get Rw%x&Chris but if i shut it down then hit command 2 i get Rw%x&in text 3 fine and then Chris in text 4 fine any suggestions?

    ------------------
    Sincerely,
    Chris
    :-) ;-)
    just have fun out there and live life to the fullest while it is still here
    Email [email protected]


  2. #2
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    Check your email :-) you need to clear strtemp2 in the second command button.

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