Käynnissä

string crypt / decrypt - porting a vb.net class in vb6

good morning

I have a class written in vb .net that encrypt and decrypt strings. I need this to port in vb6, possibly without using external control or with ebcrypt encryption libray ([url removed, login to view])

here is the class

========================

Imports [url removed, login to view]

Public Class Simple3Des

Private TripleDes As New TripleDESCryptoServiceProvider

Private Function TruncateHash(ByVal key As String, ByVal length As Integer) As Byte()

Dim sha1 As New SHA1CryptoServiceProvider

Dim keyBytes() As Byte = [url removed, login to view](key)

Dim hash() As Byte = [url removed, login to view](keyBytes)

ReDim Preserve hash(length - 1)

Return hash

End Function

Sub New(ByVal key As String)

[url removed, login to view] = TruncateHash(key, [url removed, login to view] \ 8)

[url removed, login to view] = TruncateHash("", [url removed, login to view] \ 8)

End Sub

Public Function EncryptData(ByVal plaintext As String) As String

Dim Data As String = ""

Try

Dim plaintextBytes() As Byte = [url removed, login to view](plaintext)

Dim ms As New [url removed, login to view]

Dim encStream As New CryptoStream(ms, [url removed, login to view](), [url removed, login to view])

[url removed, login to view](plaintextBytes, 0, [url removed, login to view])

[url removed, login to view]()

Data = [url removed, login to view]([url removed, login to view])

Catch ex As Exception

Return Data

End Try

Return Data

End Function

Public Function DecryptData(ByVal encryptedtext As String) As String

Dim Data As String = ""

Try

Dim encryptedBytes() As Byte =

[url removed, login to view](encryptedtext)

Dim ms As New [url removed, login to view]

Dim decStream As New CryptoStream(ms, [url removed, login to view](), [url removed, login to view])

[url removed, login to view](encryptedBytes, 0, [url removed, login to view])

[url removed, login to view]()

Data = [url removed, login to view]([url removed, login to view])

Catch ex As Exception

Return Data

End Try

Return Data

End Function

' and hash function;

Private Shared Function Generatehash(ByVal SourceText As String, ByVal Full As Boolean) As String

Dim MyMD5CryptoServiceProvider As New MD5CryptoServiceProvider

Dim j As Integer = IIf(Full, 15, 7)

Dim bs As Byte() =

[url removed, login to view]([url removed, login to view](SourceText))

Dim str As String = ""

For i As Integer = 0 To j

str = [url removed, login to view](str, [url removed, login to view]("{0:x02}", bs(i)))

Next i

MyMD5CryptoServiceProvider = Nothing

Return str

End Function

End Class

' Crypt

Dim wrapper As New Simple3Des(Generatehash([url removed, login to view], False))

Dim EncrypedPassword As String = [url removed, login to view](Password)

' Decrypt

Dim wrapper As New Simple3Des(Generatehash([url removed, login to view], False))

Dim Password As String = [url removed, login to view](EncrypedPassword)

================

Taidot: .NET, Visual Basic

Näytä lisää: encrypt decrypt sha1, sha1 decrypt string vb6, vb6 0, to string, text to string, string the, string j, string i, string hash, need convert vb6 to vb net, in vb6.0, hash string to integer, hash strings, hash string, for in vb.net, data str, and in vb6, crypt string vb6, vb6 to vb.net, vb.net for, vb.net, vb6, str, redim, io

Tietoa työnantajasta:
( 2 arvostelua ) San Zeno di Cassola, Italy

Projektin tunnus: #1721988

Myönnetty käyttäjälle:

lorjnr

Ciao, ti ho inviato un messaggio privato.

100 $ USD 3 päivässä
(5 arvostelua)
3.6

5 freelanceria on tarjonnut keskimäärin 204 $ tähän työhön

sandeep25101982

Hi, We have excellent eCommerce .Net,and PHP expertise. Please have a look at private message for relevant work done. Awaiting a positive response from your end and looking forward to work with you. Thanks

250 $ USD 10 päivässä
(31 arvostelua)
6.5
tejas34

This is very simple job for me. Please see PMB with more details.

70 $ USD 1 päivässä
(27 arvostelua)
5.8
vietitdotinfo

Please check your PMB

500 $ USD 2 päivässä
(24 arvostelua)
5.1
kfanx

One day is ok! but 3 day for sure!

100 $ USD 3 päivässä
(1 arvostelu)
2.1