Click here to Skip to main content
15,914,222 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionExecuting the content of a String Pin
JosBerb13-Nov-07 5:08
JosBerb13-Nov-07 5:08 
AnswerRe: Executing the content of a String Pin
AliAmjad13-Nov-07 5:37
AliAmjad13-Nov-07 5:37 
GeneralRe: Executing the content of a String Pin
JosBerb14-Nov-07 0:11
JosBerb14-Nov-07 0:11 
AnswerRe: Executing the content of a String Pin
nlarson1113-Nov-07 16:37
nlarson1113-Nov-07 16:37 
GeneralRe: Executing the content of a String Pin
JosBerb14-Nov-07 0:19
JosBerb14-Nov-07 0:19 
QuestionEncryption Pin
mpavas13-Nov-07 3:53
mpavas13-Nov-07 3:53 
AnswerRe: Encryption Pin
AliAmjad13-Nov-07 5:39
AliAmjad13-Nov-07 5:39 
AnswerRe: Encryption Pin
Ocean4713-Nov-07 7:13
Ocean4713-Nov-07 7:13 
This is very simple but it works!

Public Class CL_EnCrypt
Private sPsw As String = "XAN4519CEAN4719"
Private sBox(255) As String
Private sKey(255) As String

Public Property Password() As String
Get
Return sPsw
End Get
Set(ByVal sVal As String)
sPsw = sVal
End Set
End Property

Public Function DeCrypt(ByVal sWord As String) As String
If sPsw = "" Then
MsgBox("Error you must set a password first.", MsgBoxStyle.Information, "Password not set")
Return ""
End If

Return EnDeCrypt(sWord)
End Function

Public Function EnCrypt(ByVal sWord As String) As String
If sPsw = "" Then
MsgBox("Error you must set a password first.", MsgBoxStyle.Information, "Password not set")
Return ""
End If

Return EnDeCrypt(sWord)
End Function

Private Sub RC4Initialize()
Dim sSwap As String = ""
Dim A, B As Integer

Try
For A = 0 To 255
sKey(A) = Asc(Mid$(sPsw, (A Mod sPsw.Length) + 1, 1))
sBox(A) = A
Next

B = 0
For A = 0 To 255
B = (B + sBox(A) + sKey(A)) Mod 256
sSwap = sBox(A)
sBox(A) = sBox(B)
sBox(B) = sSwap
Next
Catch ex As Exception
MessageBox.Show("Encription Error - " + ex.Message, "Encription Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub

Private Function EnDeCrypt(ByVal sPlainTxt As String) As String
'This routine does all the work. Call it both to ENcrypt and to DEcrypt your data.
Dim A, I, J, K As Integer
Dim sCipherBy, sCipher, sTemp As String

Try
sCipherBy = ""
sCipher = ""
sTemp = ""
I = 0
J = 0
RC4Initialize()

For A = 1 To sPlainTxt.Length
I = (I + 1) Mod 256
J = (J + sBox(I)) Mod 256
sTemp = sBox(I)
sBox(I) = sBox(J)
sBox(J) = sTemp

K = sBox((sBox(I) + sBox(J)) Mod 256)

sCipherBy = Asc(Mid$(sPlainTxt, A, 1)) Xor K
sCipher = sCipher + Chr(sCipherBy)
Next

Return sCipher
Catch ex As Exception
MessageBox.Show("Encription Error - " + ex.Message, "Encription Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
Return ""
End Try
End Function
End Class

GeneralRe: Encryption Pin
mpavas13-Nov-07 19:20
mpavas13-Nov-07 19:20 
AnswerRe: Encryption Pin
Steven J Jowett13-Nov-07 22:41
Steven J Jowett13-Nov-07 22:41 
GeneralRe: Encryption Pin
Mark Churchill17-Dec-07 14:47
Mark Churchill17-Dec-07 14:47 
QuestionPopulate web page Pin
mcnewsxp13-Nov-07 3:48
mcnewsxp13-Nov-07 3:48 
Questiondifficult to handle datagridview with keyboard Pin
eyes200713-Nov-07 3:23
eyes200713-Nov-07 3:23 
QuestionError creating window handle Pin
Steven J Jowett13-Nov-07 1:17
Steven J Jowett13-Nov-07 1:17 
AnswerRe: Error creating window handle Pin
Steven J Jowett13-Nov-07 22:46
Steven J Jowett13-Nov-07 22:46 
QuestionCOM, Marshal, GetActiveObject Pin
Rheinflut199513-Nov-07 1:15
Rheinflut199513-Nov-07 1:15 
QuestionReference of VB6 COM & Activex components in VB.net setup : Need urgent help [modified] Pin
nishkarsh_k12-Nov-07 23:44
nishkarsh_k12-Nov-07 23:44 
AnswerRe: Reference of VB6 COM & Activex components in VB.net setup : Need urgent help Pin
Pankaj - Joshi13-Nov-07 0:30
Pankaj - Joshi13-Nov-07 0:30 
QuestionAcessing the Registry. Pin
SekharOne12-Nov-07 22:58
SekharOne12-Nov-07 22:58 
AnswerRe: Acessing the Registry. Pin
Christian Graus12-Nov-07 23:40
protectorChristian Graus12-Nov-07 23:40 
QuestionHow to speed up drop down of a combobox type column in a datagridview Pin
SekharOne12-Nov-07 22:52
SekharOne12-Nov-07 22:52 
AnswerRe: How to speed up drop down of a combobox type column in a datagridview Pin
Christian Graus12-Nov-07 23:40
protectorChristian Graus12-Nov-07 23:40 
GeneralRe: How to speed up drop down of a combobox type column in a datagridview Pin
SekharOne13-Nov-07 0:32
SekharOne13-Nov-07 0:32 
Questionnow a can read text file line by line but how to split it [modified] Pin
abdullah Hejory12-Nov-07 22:26
abdullah Hejory12-Nov-07 22:26 
AnswerRe: now a can read text file line by line but how to split it Pin
Christian Graus12-Nov-07 23:43
protectorChristian Graus12-Nov-07 23:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.