[VB.NET] All encryptions for your crypter - Oeno - Mar 26, 2011
Rijndael:
Code Public Shared Function Rijndaelcrypt(ByVal File As String, ByVal Key As String)
Dim oAesProvider As New RijndaelManaged
Dim btClear() As Byte
Dim btSalt() As Byte = New Byte() {1, 2, 3, 4, 5, 6, 7, 8}
Dim oKeyGenerator As New Rfc2898DeriveBytes(Key, btSalt)
oAesProvider.Key = oKeyGenerator.GetBytes(oAesProvider.Key.Length)
oAesProvider.IV = oKeyGenerator.GetBytes(oAesProvider.IV.Length)
Dim ms As New IO.MemoryStream
Dim cs As New CryptoStream(ms, _
oAesProvider.CreateEncryptor(), _
CryptoStreamMode.Write)
btClear = System.Text.Encoding.UTF8.GetBytes(File)
cs.Write(btClear, 0, btClear.Length)
cs.Close()
File = Convert.ToBase64String(ms.ToArray)
Return File
End Function
Public Shared Function RijndaelDecrypt(ByVal UDecryptU As String, ByVal UKeyU As String)
Dim XoAesProviderX As New RijndaelManaged
Dim XbtCipherX() As Byte
Dim XbtSaltX() As Byte = New Byte() {1, 2, 3, 4, 5, 6, 7, 8}
Dim XoKeyGeneratorX As New Rfc2898DeriveBytes(UKeyU, XbtSaltX)
XoAesProviderX.Key = XoKeyGeneratorX.GetBytes(XoAesProviderX.Key.Length)
XoAesProviderX.IV = XoKeyGeneratorX.GetBytes(XoAesProviderX.IV.Length)
Dim XmsX As New IO.MemoryStream
Dim XcsX As New CryptoStream(XmsX, XoAesProviderX.CreateDecryptor(), _
CryptoStreamMode.Write)
Try
XbtCipherX = Convert.FromBase64String(UDecryptU)
XcsX.Write(XbtCipherX, 0, XbtCipherX.Length)
XcsX.Close()
UDecryptU = System.Text.Encoding.UTF8.GetString(XmsX.ToArray)
Catch
End Try
Return UDecryptU
End Function
Xor:
Code Public Function Encrypt(ByVal CodeKey As String, ByVal DataIn As String) As String
Dim lonDataPtr As Long
Dim strDataOut As String
Dim temp As Integer
Dim tempstring As String
Dim intXOrValue1 As Integer
Dim intXOrValue2 As Integer
For lonDataPtr = 1 To Len(DataIn)
intXOrValue1 = Asc(Mid$(DataIn, lonDataPtr, 1))
intXOrValue2 = Asc(Mid$(CodeKey, ((lonDataPtr Mod Len(CodeKey)) + 1), 1))
temp = (intXOrValue1 Xor intXOrValue2)
tempstring = Hex(temp)
If Len(tempstring) = 1 Then tempstring = "0" & tempstring
strDataOut = strDataOut + tempstring
Next lonDataPtr
Return strDataOut
End Function
Public Function Decrypt(ByVal CodeKey As String, ByVal DataIn As String) As String
Dim lonDataPtr As Long
Dim strDataOut As String
Dim intXOrValue1 As Integer
Dim intXOrValue2 As Integer
For lonDataPtr = 1 To (Len(DataIn) / 2)
intXOrValue1 = Val("&H" & (Mid$(DataIn, (2 * lonDataPtr) - 1, 2)))
intXOrValue2 = Asc(Mid$(CodeKey, ((lonDataPtr Mod Len(CodeKey)) + 1), 1))
strDataOut = strDataOut + Chr(intXOrValue1 Xor intXOrValue2)
Next lonDataPtr
Return strDataOut
End Function
[u]stub :
[/u]
Public Function XOR(ByVal CodeKey As String, ByVal DataIn As String) As String
Dim lonDataPtr As Long
Dim strDataOut As String
Dim intXOrValue1 As Integer
Dim intXOrValue2 As Integer
For lonDataPtr = 1 To (Len(DataIn) / 2)
intXOrValue1 = Val("&H" & (Mid$(DataIn, (2 * lonDataPtr) - 1, 2)))
intXOrValue2 = Asc(Mid$(CodeKey, ((lonDataPtr Mod Len(CodeKey)) + 1), 1))
strDataOut = strDataOut + Chr(intXOrValue1 Xor intXOrValue2)
Next lonDataPtr
xEncryption = strDataOut
End Function
Polymorphic Stairs:
Code Imports System.Text
Public Class PolyMorphicStairs
Overloads Shared Function PolyCrypt(ByVal Data As String, ByVal Key As String, Optional ByVal ExtraRounds As UInteger = 0) As String
Dim buff() As Byte = PolyCrypt(Encoding.Default.GetBytes(Data), Encoding.Default.GetBytes(Key), ExtraRounds)
PolyCrypt = Encoding.Default.GetString(buff)
Erase buff
End Function
Overloads Shared Function PolyDeCrypt(ByVal Data As String, ByVal Key As String, Optional ByVal ExtraRounds As UInteger = 0) As String
Dim buff() As Byte = PolyDeCrypt(Encoding.Default.GetBytes(Data), Encoding.Default.GetBytes(Key), ExtraRounds)
PolyDeCrypt = Encoding.Default.GetString(buff)
Erase buff
End Function
Overloads Shared Function PolyCrypt(ByRef Data() As Byte, ByVal Key() As Byte, Optional ByVal ExtraRounds As UInteger = 0) As Byte()
Array.Resize(Data, Data.Length + 1)
Data(Data.Length - 1) = Convert.ToByte(New Random().Next(1, 255))
For i = (Data.Length - 1) * (ExtraRounds + 1) To 0 Step -1
Data(i Mod Data.Length) = CByte(CInt((Data(i Mod Data.Length)) + CInt(Data((i + 1) Mod Data.Length))) Mod 256) Xor Key(i Mod Key.Length)
Next
Return Data
End Function
Overloads Shared Function PolyDeCrypt(ByRef Data() As Byte, ByVal Key() As Byte, Optional ByVal ExtraRounds As UInteger = 0) As Byte()
For i = 0 To (Data.Length - 1) * (ExtraRounds + 1)
Data(i Mod Data.Length) = CByte((CInt(Data(i Mod Data.Length) Xor Key(i Mod Key.Length)) - CInt(Data((i + 1) Mod Data.Length)) + 256) Mod 256)
Next
Array.Resize(Data, Data.Length - 1)
Return Data
End Function
End Class
Stairs:
Code Imports System.Text
Public Class StairsEncryption
Public Shared Function Crypt(ByVal Data As String, ByVal key As String) As String
Return Encoding.Default.GetString(Crypt(Encoding.Default.GetBytes(Data), Encoding.Default.GetBytes(key)))
End Function
Public Shared Function Crypt(ByVal Data() As Byte, ByVal key() As Byte) As Byte()
For i = 0 To (Data.Length * 2) + Key.Length
Data(i Mod Data.Length) = CByte(CInt((Data(i Mod Data.Length)) + CInt(Data((i + 1) Mod Data.Length))) Mod 256) Xor key(i Mod key.Length)
Next
Return Data
End Function
Public Shared Function DeCrypt(ByVal Data As String, ByVal key As String) As String
Return Encoding.Default.GetString(DeCrypt(Encoding.Default.GetBytes(Data), Encoding.Default.GetBytes(key)))
End Function
Public Shared Function DeCrypt(ByVal Data() As Byte, ByVal key() As Byte) As Byte()
For i = (Data.Length * 2) + Key.Length To 0 Step -1
Data(i Mod Data.Length) = CByte((CInt(Data(i Mod Data.Length) Xor key(i Mod key.Length)) - CInt(Data((i + 1) Mod Data.Length)) + 256) Mod 256)
Next
Return Data
End Function
End Class
Polymorphic RC4:
Code Imports System.Text
Public Class PolyRC4
Private Key As String = "met ce que tu veux, c'est comme ton code"
Sub New(ByVal EncryptionKey As String)
Key = EncryptionKey
End Sub
Public Function Encrypt(ByVal message As String) As String
message = x(message, Key)
Dim random As New Random()
Dim list1 As New ArrayList(), list2 As New ArrayList()
Dim out As String = ""
Dim num1 As Integer = random.[Next](1, 10255)
For i As Integer = 0 To message.Length - 1
Dim num2 As Integer = random.[Next](num1) '(&H7A) + &H44
list1.Add(Convert.ToInt32(message(i)) + num2)
list2.Add(num2)
Next
For j As Integer = 0 To message.Length - 1
out += ChrW(list1(j)) & ChrW(list2(j))
Next
Return out
End Function
Public Function Decrypt(ByVal message As String) As String
Dim numArray As Integer() = New Integer(message.Length - 1) {}
Dim temp As String = ""
For i As Integer = 0 To message.Length - 1
numArray(i) = Convert.ToInt32(message(i))
Next
For j As Integer = 0 To message.Length - 1 Step 2
Dim num3 As Integer = numArray(j)
Dim num4 As Integer = numArray(j + 1)
Dim num5 As Integer = num3 - num4
temp = temp + ChrW(num5)
Next
Return x(temp, Key)
End Function
Private Function x(ByVal nGeeKnK As String, ByVal eKieBrN As String) As String
Dim oHgeIrT As Integer = 0
Dim rErnEoE As Integer = 0
Dim rEeiRfF As New StringBuilder
Dim nJrnJgL As String = String.Empty
Dim bIjeGnR As Integer() = New Integer(256) {}
Dim nBjvRbE As Integer() = New Integer(256) {}
Dim gEgeGnE As Integer = eKieBrN.Length
Dim fBjeEgE As Integer = 0
While fBjeEgE <= 255
Dim fGrjEnG As Char = (eKieBrN.Substring((fBjeEgE Mod gEgeGnE), 1).ToCharArray()(0))
nBjvRbE(fBjeEgE) = Microsoft.VisualBasic.Strings.Asc(fGrjEnG)
bIjeGnR(fBjeEgE) = fBjeEgE
System.Math.Max(System.Threading.Interlocked.Increment(fBjeEgE), fBjeEgE - 1)
End While
Dim vHbrDnG As Integer = 0
Dim jPkkXjV As Integer = 0
While jPkkXjV <= 255
vHbrDnG = (vHbrDnG + bIjeGnR(jPkkXjV) + nBjvRbE(jPkkXjV)) Mod 256
Dim nCokVrH As Integer = bIjeGnR(jPkkXjV)
bIjeGnR(jPkkXjV) = bIjeGnR(vHbrDnG)
bIjeGnR(vHbrDnG) = nCokVrH
System.Math.Max(System.Threading.Interlocked.Increment(jPkkXjV), jPkkXjV - 1)
End While
fBjeEgE = 1
While fBjeEgE <= nGeeKnK.Length
Dim rErrTnE As Integer = 0
oHgeIrT = (oHgeIrT + 1) Mod 256
rErnEoE = (rErnEoE + bIjeGnR(oHgeIrT)) Mod 256
rErrTnE = bIjeGnR(oHgeIrT)
bIjeGnR(oHgeIrT) = bIjeGnR(rErnEoE)
bIjeGnR(rErnEoE) = rErrTnE
Dim rHgeHgH As Integer = bIjeGnR((bIjeGnR(oHgeIrT) + bIjeGnR(rErnEoE)) Mod 256)
Dim fGrjEnG As Char = nGeeKnK.Substring(fBjeEgE - 1, 1).ToCharArray()(0)
rErrTnE = Asc(fGrjEnG)
Dim vRbTKeR As Integer = rErrTnE Xor rHgeHgH
rEeiRfF.Append(Chr(vRbTKeR))
System.Math.Max(System.Threading.Interlocked.Increment(fBjeEgE), fBjeEgE - 1)
End While
nJrnJgL = rEeiRfF.ToString
rEeiRfF.Length = 0
Return nJrnJgL
End Function
End Class
Dim x As New PolyRC4("what ever you want here")
TextBox2.Text = x.Encrypt(TextBox1.Text)
3DES :
Code Imports System.Text
Imports System.Security.Cryptography
Public Class 3DES
Public Shared Function Encrypt(ByVal toEncrypt As String, ByVal key As String, ByVal useHashing As Boolean) As String
Dim keyArray As Byte()
Dim toEncryptArray As Byte() = UTF8Encoding.UTF8.GetBytes(toEncrypt)
If useHashing Then
Dim hashmd5 As New MD5CryptoServiceProvider()
keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key))
Else
keyArray = UTF8Encoding.UTF8.GetBytes(key)
End If
Dim tdes As New TripleDESCryptoServiceProvider()
tdes.Key = keyArray
tdes.Mode = CipherMode.ECB
tdes.Padding = PaddingMode.PKCS7
Dim cTransform As ICryptoTransform = tdes.CreateEncryptor()
Dim resultArray As Byte() = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length)
Return Convert.ToBase64String(resultArray, 0, resultArray.Length)
End Function
End Class
3DES + MD5 :
Code Imports System.Text
Imports System.Security.Cryptography
Public Class MD5
Public Shared Function Encrypt(ByVal bytData() As Byte, _
ByVal sKey As String, _
Optional ByVal tMode As CipherMode = CipherMode.ECB, _
Optional ByVal tPadding As PaddingMode = PaddingMode.PKCS7) As Byte()
Dim keyArray As Byte()
Dim hashmd5 As New MD5CryptoServiceProvider()
keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(sKey))
hashmd5.Clear()
Dim tdes As New TripleDESCryptoServiceProvider()
tdes.Key = keyArray
tdes.Mode = tMode
tdes.Padding = tPadding
Dim cTransform As ICryptoTransform = tdes.CreateEncryptor()
Dim resultArray As Byte() = cTransform.TransformFinalBlock(bytData, 0, bytData.Length)
tdes.Clear()
Return resultArray
End Function
Public Shared Function Decrypt(ByVal bytData() As Byte, _
ByVal sKey As String, _
Optional ByVal tMode As CipherMode = CipherMode.ECB, _
Optional ByVal tPadding As PaddingMode = PaddingMode.PKCS7) As Byte()
Dim keyArray As Byte()
Dim hashmd5 As New MD5CryptoServiceProvider()
keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(sKey))
hashmd5.Clear()
Dim tdes As New TripleDESCryptoServiceProvider()
tdes.Key = keyArray
tdes.Mode = tMode
tdes.Padding = tPadding
Dim cTransform As ICryptoTransform = tdes.CreateDecryptor()
Dim resultArray As Byte() = cTransform.TransformFinalBlock(bytData, 0, bytData.Length)
tdes.Clear()
Return resultArray
End Function
End Class
RC4:
Code Private Shared Function Proper_RC4(ByVal Input As Byte(), ByVal Key As Byte()) As Byte()
'Leave a thanks at least..
'by d3c0mpil3r from HF
Dim i, j, swap As UInteger
Dim s As UInteger() = New UInteger(255) {}
Dim Output As Byte() = New Byte(Input.Length - 1) {}
For i = 0 To 255
s(i) = i
Next
For i = 0 To 255
j = (j + Key(i Mod Key.Length) + s(i)) And 255
swap = s(i) 'Swapping of s(i) and s(j)
s(i) = s(j)
s(j) = swap
Next
i = 0 : j = 0
For c = 0 To Output.Length - 1
i = (i + 1) And 255
j = (j + s(i)) And 255
swap = s(i) 'Swapping of s(i) and s(j)
s(i) = s(j)
s(j) = swap
Output(c) = Input(c) Xor s((s(i) + s(j)) And 255)
Next
Return Output
End Function
Blowfish:
Code http://pastebin.com/NKwJftpQ
(I put the code in pastebin because the code is too long)
RC2:
Code Public Function RC2Encrypt(ByVal strInput As String, ByVal strPassword As String) As String
Dim RC2 As New System.Security.Cryptography.RC2CryptoServiceProvider
Dim HashRC2 As New System.Security.Cryptography.MD5CryptoServiceProvider
Dim strEncrypted As String = ""
Try
Dim Hash() As Byte = HashRC2.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(strPassword))
RC2.Key = Hash
RC2.Mode = Security.Cryptography.CipherMode.ECB
Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = RC2.CreateEncryptor
Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(strInput)
strEncrypted = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
Return strEncrypted
Catch ex As Exception
End Try
End Function
Public Function RC2Decrypt(ByVal strInput As String, ByVal strPassword As String) As String
Dim RC2 As New System.Security.Cryptography.RC2CryptoServiceProvider
Dim HashRC2 As New System.Security.Cryptography.MD5CryptoServiceProvider
Dim strDecrypted As String = ""
Try
Dim Hash() As Byte = HashRC2.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(strPassword))
RC2.Key = Hash
RC2.Mode = Security.Cryptography.CipherMode.ECB
Dim DESDecrypter As System.Security.Cryptography.ICryptoTransform = RC2.CreateDecryptor
Dim Buffer As Byte() = Convert.FromBase64String(strInput)
strDecrypted = System.Text.ASCIIEncoding.ASCII.GetString(DESDecrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
Return strDecrypted
Catch ex As Exception
End Try
End Function
Crédits:
Me (making the thread)
--Owner-- (pitifoul)
* - no1me - Mar 26, 2011
not all but its good for the new guys in 1 theard. add more if u find
* - Grieve™ - Mar 26, 2011
thanks very much for this!
* - hacphongthan - Mar 26, 2011
nice collect
thanks alot
* - N3oNight - Mar 27, 2011
Thanks For this..
Very Nice collection...
* - Modestep - Mar 27, 2011
I tried the Xor one and he had a few errors, i fixed them. Here is the working XOR:
Code Public Function Encrypt(ByVal CodeKey As String, ByVal DataIn As String) As String
Dim lonDataPtr As Long
Dim strDataOut As String
Dim temp As Integer
Dim tempstring As String
Dim intXOrValue1 As Integer
Dim intXOrValue2 As Integer
For lonDataPtr = 1 To Len(DataIn)
intXOrValue1 = Asc(Mid$(DataIn, lonDataPtr, 1))
intXOrValue2 = Asc(Mid$(CodeKey, ((lonDataPtr Mod Len(CodeKey)) + 1), 1))
temp = (intXOrValue1 Xor intXOrValue2)
tempstring = Hex(temp)
If Len(tempstring) = 1 Then tempstring = "0" & tempstring
strDataOut = strDataOut + tempstring
Next lonDataPtr
Return strDataOut
End Function
Public Function Decrypt(ByVal CodeKey As String, ByVal DataIn As String) As String
Dim lonDataPtr As Long
Dim strDataOut As String
Dim intXOrValue1 As Integer
Dim intXOrValue2 As Integer
For lonDataPtr = 1 To (Len(DataIn) / 2)
intXOrValue1 = Val("&H" & (Mid$(DataIn, (2 * lonDataPtr) - 1, 2)))
intXOrValue2 = Asc(Mid$(CodeKey, ((lonDataPtr Mod Len(CodeKey)) + 1), 1))
strDataOut = strDataOut + Chr(intXOrValue1 Xor intXOrValue2)
Next lonDataPtr
Return strDataOut
End Function
* - Oeno - Mar 27, 2011
(Mar 27, 2011 01:14 AM)dudesons123 Wrote: I tried the Xor one and he had a few errors, i fixed them. Here is the working XOR:
Code Public Function Encrypt(ByVal CodeKey As String, ByVal DataIn As String) As String
Dim lonDataPtr As Long
Dim strDataOut As String
Dim temp As Integer
Dim tempstring As String
Dim intXOrValue1 As Integer
Dim intXOrValue2 As Integer
For lonDataPtr = 1 To Len(DataIn)
intXOrValue1 = Asc(Mid$(DataIn, lonDataPtr, 1))
intXOrValue2 = Asc(Mid$(CodeKey, ((lonDataPtr Mod Len(CodeKey)) + 1), 1))
temp = (intXOrValue1 Xor intXOrValue2)
tempstring = Hex(temp)
If Len(tempstring) = 1 Then tempstring = "0" & tempstring
strDataOut = strDataOut + tempstring
Next lonDataPtr
Return strDataOut
End Function
Public Function Decrypt(ByVal CodeKey As String, ByVal DataIn As String) As String
Dim lonDataPtr As Long
Dim strDataOut As String
Dim intXOrValue1 As Integer
Dim intXOrValue2 As Integer
For lonDataPtr = 1 To (Len(DataIn) / 2)
intXOrValue1 = Val("&H" & (Mid$(DataIn, (2 * lonDataPtr) - 1, 2)))
intXOrValue2 = Asc(Mid$(CodeKey, ((lonDataPtr Mod Len(CodeKey)) + 1), 1))
strDataOut = strDataOut + Chr(intXOrValue1 Xor intXOrValue2)
Next lonDataPtr
Return strDataOut
End Function
Added to the list thanks. If you have other codes post here.
* - The Enforcer - Mar 27, 2011
thanks a lot man ....better sticky this thread..
* - wertyl11 - Mar 27, 2011
Damn dude!! Finally someone had this!! I love you!! Respect for this!!
EDIT:
Maybe you can add Blowfish also ?
* - Oeno - Mar 27, 2011
Blowfish added to the list.
* - Modestep - Mar 27, 2011
Here is the code for RC2;
Code Public Function RC2Encrypt(ByVal strInput As String, ByVal strPassword As String) As String
Dim RC2 As New System.Security.Cryptography.RC2CryptoServiceProvider
Dim HashRC2 As New System.Security.Cryptography.MD5CryptoServiceProvider
Dim strEncrypted As String = ""
Try
Dim Hash() As Byte = HashRC2.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(strPassword))
RC2.Key = Hash
RC2.Mode = Security.Cryptography.CipherMode.ECB
Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = RC2.CreateEncryptor
Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(strInput)
strEncrypted = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
Return strEncrypted
Catch ex As Exception
End Try
End Function
Public Function RC2Decrypt(ByVal strInput As String, ByVal strPassword As String) As String
Dim RC2 As New System.Security.Cryptography.RC2CryptoServiceProvider
Dim HashRC2 As New System.Security.Cryptography.MD5CryptoServiceProvider
Dim strDecrypted As String = ""
Try
Dim Hash() As Byte = HashRC2.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(strPassword))
RC2.Key = Hash
RC2.Mode = Security.Cryptography.CipherMode.ECB
Dim DESDecrypter As System.Security.Cryptography.ICryptoTransform = RC2.CreateDecryptor
Dim Buffer As Byte() = Convert.FromBase64String(strInput)
strDecrypted = System.Text.ASCIIEncoding.ASCII.GetString(DESDecrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
Return strDecrypted
Catch ex As Exception
End Try
End Function
* - Oeno - Mar 27, 2011
(Mar 27, 2011 07:24 AM)dudesons123 Wrote: Here is the code for RC2;
Code Public Function RC2Encrypt(ByVal strInput As String, ByVal strPassword As String) As String
Dim RC2 As New System.Security.Cryptography.RC2CryptoServiceProvider
Dim HashRC2 As New System.Security.Cryptography.MD5CryptoServiceProvider
Dim strEncrypted As String = ""
Try
Dim Hash() As Byte = HashRC2.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(strPassword))
RC2.Key = Hash
RC2.Mode = Security.Cryptography.CipherMode.ECB
Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = RC2.CreateEncryptor
Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(strInput)
strEncrypted = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
Return strEncrypted
Catch ex As Exception
End Try
End Function
Public Function RC2Decrypt(ByVal strInput As String, ByVal strPassword As String) As String
Dim RC2 As New System.Security.Cryptography.RC2CryptoServiceProvider
Dim HashRC2 As New System.Security.Cryptography.MD5CryptoServiceProvider
Dim strDecrypted As String = ""
Try
Dim Hash() As Byte = HashRC2.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(strPassword))
RC2.Key = Hash
RC2.Mode = Security.Cryptography.CipherMode.ECB
Dim DESDecrypter As System.Security.Cryptography.ICryptoTransform = RC2.CreateDecryptor
Dim Buffer As Byte() = Convert.FromBase64String(strInput)
strDecrypted = System.Text.ASCIIEncoding.ASCII.GetString(DESDecrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
Return strDecrypted
Catch ex As Exception
End Try
End Function
thanks for this code.
RC2 Added to the list.
Haterz rate 1 star ? wow
* - Whitе - Apr 1, 2011
because i can and im using it atm lols :D
* - FileX - Apr 1, 2011
Ohmy gawd, thank you very much, I really needed this
* - 4(1d.r41n - Apr 1, 2011
Wow thanks I could use this is. BTW are any of these scantime UD?
|