VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This program lets you decide the passkey length to b generated. Also it lets you copy and paste in

by Adam Melton/ (redoo of yesterdays and better) this is a mod of Frank Kley's 128 bit encryption ()
Category: Encryption
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 20th January 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This program lets you decide the passkey length to b generated. Also it lets you copy and paste in the cryptkey box so that you can send

API Declarations


' you need 5 textboxes first 4 with deault names. 5th ont is called CR_Key
'also you need 3 command buttons named BenKeyB, CryptB, and DecryptB.
'CR_Key is the crypt key. text1 is the text to encrypt.
'text2 is the crypted text. text 3 is the rypt key length(Default 128)
'and text 4 is th edecrypted text.

Rate This program lets you decide the passkey length to b generated. Also it lets you copy and paste in



    Text3.Text = "128"
  Call GenKeyB_Click
End Sub
Function GenCryptKey() As String
keylen = Text3.Text
    s = Int(Right(Timer, 5))
    For i = 1 To keylen
      For t = 0 To s
        Rnd
      Next t
      a$ = Chr$(Int(Rnd * 255))
      CR = CR + a$
    Next i
    GenCryptKey = CR

End Function
Function Crypt(Inpu As String, CKey As String) As String
    EXPO = 3
    DL = 2 ^ EXPO
        
        For i = 1 To Len(Inpu)
            W = Asc(Mid$(Inpu, i, 1)) + Asc(Mid$(CKey, DL, 1))
            If W > 255 Then W = W - 255
            a$ = a$ + Chr$(W)
            DL = DL + 1
            If DL > 2 ^ (EXPO + 1) Then
               If EXPO = 6 Then EXPO = 3: GoTo EXPSET
               If EXPO = 3 Then EXPO = 5: GoTo EXPSET
               If EXPO = 5 Then EXPO = 2: GoTo EXPSET
               If EXPO = 2 Then EXPO = 4: GoTo EXPSET
               If EXPO = 4 Then EXPO = 1: GoTo EXPSET
               If EXPO = 1 Then EXPO = 0: GoTo EXPSET
               If EXPO = 0 Then EXPO = 6: GoTo EXPSET
EXPSET:
               DL = 2 ^ EXPO
            End If
        Next i
        Crypt = a$
End Function
Function DeCrypt(Inpu As String, CKey As String) As String
    EXPO = 3
    DL = 2 ^ EXPO
        For i = 1 To Len(Inpu)
            W = Asc(Mid$(Inpu, i, 1)) - Asc(Mid$(CKey, DL, 1))
            If W < 0 Then W = W + 255
            a$ = a$ + Chr$(W)
            DL = DL + 1
            If DL > 2 ^ (EXPO + 1) Then
               If EXPO = 6 Then EXPO = 3: GoTo EXPSET
               If EXPO = 3 Then EXPO = 5: GoTo EXPSET
               If EXPO = 5 Then EXPO = 2: GoTo EXPSET
               If EXPO = 2 Then EXPO = 4: GoTo EXPSET
               If EXPO = 4 Then EXPO = 1: GoTo EXPSET
               If EXPO = 1 Then EXPO = 0: GoTo EXPSET
               If EXPO = 0 Then EXPO = 6: GoTo EXPSET
EXPSET:
               DL = 2 ^ EXPO
            End If
        Next i
        DeCrypt = a$
End Function
Private Sub CryptB_Click()
   Text2.Text = Crypt(Text1.Text, CR_Key.Text)
End Sub
Private Sub DeCryptB_Click()
   Text4.Text = DeCrypt(Text2.Text, CR_Key.Text)
End Sub
Private Sub GenKeyB_Click()
keylen = Text3.Text
  CR_Key.Text = ""
  While Len(CR_Key.Text) <> keylen
     CR_Key.Text = GenCryptKey
  Wend

End Sub


Private Sub Text3_click()
Text3.Text = ""
End Sub


Download this snippet    Add to My Saved Code

This program lets you decide the passkey length to b generated. Also it lets you copy and paste in Comments

No comments have been posted about This program lets you decide the passkey length to b generated. Also it lets you copy and paste in . Why not be the first to post a comment about This program lets you decide the passkey length to b generated. Also it lets you copy and paste in .

Post your comment

Subject:
Message:
0/1000 characters