Re: Total confused and need help with small encryption and decryption methods
- From: manmit.walia@xxxxxxxxx
- Date: 3 Apr 2007 14:11:00 -0700
On Apr 3, 4:21 pm, "Freiddie" <fei.yua...@xxxxxxxxx> wrote:
I agree. It's better to use more secure methods such as
System.Security.Cryptography. There is little space here to explain in
detail, but I can give you an example if you want.
Freiddiehttp://fei.yuanbw.googlepages.com/http://freiddy.blogspot.com/http://crazibe.blogspot.com/
I would have used the Cryptography class in .NET but as I said the
current cryptology that is being used was written in VB6 or so. And I
can not change the way the text is encrypted or decrypted becuase
there are applications written using the exisiting code. All I am
charge to do is convert it to an C# dll file so that future apps can
use the .NET version rather then the vb version.
Here is the original VB. version
Attribute VB_Name = "Module1"
Option Explicit
Dim pass$
Dim Strg$
Function decrypt(ByVal H$) As String
Dim i As Integer, J$
pass$ = "THEFELDGROUP"
'H$ = the buffered encrypted data
H$ = Mid$(H$, 3, Val(Left$(H$, 2)))
' debuffer it
Strg$ = ""
For i = 1 To Len(H$) Step 2
J$ = Mid$(H$, i, 2)
Strg$ = Strg$ + Chr$(Val("&H" + J$))
Next
'Strg$ now contains the encrypted string, which you can now
'decrypt.
Call Crypt(pass$, Strg$)
'strg$ now is decrypted
decrypt = Strg$
End Function
Function Crypt(pass$, Strg$)
Dim a, b
Dim i As Integer
a = 1
For i = 1 To Len(Strg$)
b = Asc(Mid$(pass$, a, 1)): a = a + 1: If a > Len(pass$) Then a
=
1
Mid$(Strg$, i, 1) = Chr$(Asc(Mid$(Strg$, i, 1)) Xor b)
Next
End Function
.
- Follow-Ups:
- References:
- Prev by Date: Re: Total confused and need help with small encryption and decryption methods
- Next by Date: Re: Process.ExitCode fails
- Previous by thread: Re: Total confused and need help with small encryption and decryption methods
- Next by thread: Re: Total confused and need help with small encryption and decryption methods
- Index(es):
Relevant Pages
|