Not a Member Yet,
Click here to Register
How do you like the new design?






ID: 7
Viewed: 3039
Added: Nov 21, 2001
Version:
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

Encrypts a text string.

Highlight all by clicking in box
<!---Declaration--->
none

Highlight All
<!---Code--->
'add this into a form with 3 Textboxes and a Command Button
'Text1 is the message to encypt/decrypt
'Text2 is the "1" or anything else (tells whetehrt o encrypt or not)
'Text3 is the result
Private Sub Command1_Click()

Dim iSeed As Integer
Dim keyTxt, messageTxt, decrypt, directionTxt As String
keyText = "dog"
messageTxt = Text1.Text
directionTxt = Text2.Text
iSeed = 0
Rnd (-1)
Randomize (iSeed)
For i = 1 To Len(keyTxt)
iSeed = iSeed + Asc(Mid(keyTxt, i, 1))
Next
decrypt = ""
For i = 1 To Len(messageTxt)
If (directionTxt = "1") Then
decrypt = decrypt & Chr((Asc(Mid(messageTxt, i, 1)) + (Int(Rnd() * 10))))
Else
decrypt = decrypt & Chr((Asc(Mid(messageTxt, i, 1)) - (Int(Rnd() * 10))))
End If
Next
Text3.Text = decrypt
;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 snippetlibrary.com All Rights Reserved. Conditions