Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Easy Code to Encrypt and Decrypt....
Author:
Raghuraja.C
E-mail:
Click to e-mail author
Submitted:
2/17/2003
Version:
VB6
Compatibility:
VB6
Category:
Security
Views:
16575
Easy Code to Encrypt and Decrypt.
Declarations:
'none
Code:
'To encrypt the required String Public Function fcnEncrypt(valToEncrpt As String) As String Dim strOriVal As String Dim intEnCry As String Dim intInc As Integer Dim rndVal1 As Integer Dim rndVal2 As Integer strOriVal = valToEncrpt rndVal1 = Round(Rnd(9) * 10) rndVal2 = Round(Rnd(9) * 5) If rndVal1 = 0 Then rndVal1 = 4 End If For intInc = 1 To Len(strOriVal) intEnCry = Chr(Asc(Mid(strOriVal, intInc, 1)) + rndVal1 - rndVal2) & intEnCry Next fcnEncrypt = Chr(rndVal1) & intEnCry & Chr(rndVal2) End Function 'To decrept the required String Public Function fcnDecrpt(valToDecrpt As String) As String Dim strOriVal As String Dim strDeCry As String Dim intInc As Integer Dim rndVal1 As Integer Dim rndVal2 As Integer strOriVal = valToDecrpt rndVal1 = Asc(Left(strOriVal, 1)) rndVal2 = Asc(Right(strOriVal, 1)) strOriVal = Mid(strOriVal, 2, Len(strOriVal) - 2) For intInc = 1 To Len(strOriVal) strDeCry = Chr(Asc(Mid(strOriVal, intInc, 1)) - rndVal1 + rndVal2) & strDeCry Next fcnDecrpt = strDeCry End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement