Visitante
Ingresar
Registrarse
Underc0de - Hacking y seguridad informática
Menu
Inicio
Website
Blog
Buscar
Calendario
Ingresar
Registrarse
Underc0de - Hacking y seguridad informática
»
Programación General
»
C# - VB.NET
Encrypt&Decrypt (xor,des,rc2,tripleDES)
Imprimir
Páginas: [
1
]
Ir Abajo
« anterior
próximo »
Encrypt&Decrypt (xor,des,rc2,tripleDES)
2 Respuestas
4293 Vistas
0 Usuarios y 1 Visitante están viendo este tema.
Expermicid
Ex-Staff
Mensajes: 463
Actividad:
0%
Reputación 0
_-Expermicid-_
Skype: expermicid.xd
Encrypt&Decrypt (xor,des,rc2,tripleDES)
en: Junio 25, 2012, 12:18:37 am
DES
Código: vb.net
Public
Function
DES_Encrypt
(
ByVal
input
As
String
,
ByVal
pass
As
String
)
As
String
Dim
DES
As
New
System
.
Security
.
Cryptography
.
DESCryptoServiceProvider
Dim
Hash_DES
As
New
System
.
Security
.
Cryptography
.
MD5CryptoServiceProvider
Dim
encrypted
As
String
=
""
Try
Dim
hash
(
7
)
As
Byte
Dim
temp
As
Byte
(
)
=
Hash_DES
.
ComputeHash
(
System
.
Text
.
ASCIIEncoding
.
ASCII
.
GetBytes
(
pass
)
)
Array
.
Copy
(
temp,
0
, hash,
0
,
<
img src
=
"https://underc0de.org/foro/Smileys/default/cool.gif"
alt
=
"8)"
title
=
"Cool"
class
=
"smiley"
/>
DES
.
Key
=
hash
DES
.
Mode
=
Security
.
Cryptography
.
CipherMode
.
ECB
Dim
DESEncrypter
As
System
.
Security
.
Cryptography
.
ICryptoTransform
=
DES
.
CreateEncryptor
Dim
Buffer
As
Byte
(
)
=
System
.
Text
.
ASCIIEncoding
.
ASCII
.
GetBytes
(
Input
)
encrypted
=
Convert
.
ToBase64String
(
DESEncrypter
.
TransformFinalBlock
(
Buffer,
0
, Buffer
.
Length
)
)
Return
encrypted
Catch
ex
As
Exception
End
Try
End
Function
Código: vb.net
Public
Function
DES_Decrypt
(
ByVal
input
As
String
,
ByVal
pass
As
String
)
As
String
Dim
DES
As
New
System
.
Security
.
Cryptography
.
DESCryptoServiceProvider
Dim
Hash_DES
As
New
System
.
Security
.
Cryptography
.
MD5CryptoServiceProvider
Dim
decrypted
As
String
=
""
Try
Dim
hash
(
7
)
As
Byte
Dim
temp
As
Byte
(
)
=
Hash_DES
.
ComputeHash
(
System
.
Text
.
ASCIIEncoding
.
ASCII
.
GetBytes
(
pass
)
)
Array
.
Copy
(
temp,
0
, hash,
0
,
<
img src
=
"https://underc0de.org/foro/Smileys/default/cool.gif"
alt
=
"8)"
title
=
"Cool"
class
=
"smiley"
/>
DES
.
Key
=
hash
DES
.
Mode
=
Security
.
Cryptography
.
CipherMode
.
ECB
Dim
DESDecrypter
As
System
.
Security
.
Cryptography
.
ICryptoTransform
=
DES
.
CreateDecryptor
Dim
Buffer
As
Byte
(
)
=
Convert
.
FromBase64String
(
input
)
decrypted
=
System
.
Text
.
ASCIIEncoding
.
ASCII
.
GetString
(
DESDecrypter
.
TransformFinalBlock
(
Buffer,
0
, Buffer
.
Length
)
)
Return
decrypted
Catch
ex
As
Exception
End
Try
End
Function
RC2
Código: vb.net
Public
Function
RC2_Encrypt
(
ByVal
input
As
String
,
ByVal
pass
As
String
)
As
String
Dim
RC2
As
New
System
.
Security
.
Cryptography
.
RC2CryptoServiceProvider
Dim
Hash_RC2
As
New
System
.
Security
.
Cryptography
.
MD5CryptoServiceProvider
Dim
encrypted
As
String
=
""
Try
Dim
hash
(
)
As
Byte
=
Hash_RC2
.
ComputeHash
(
System
.
Text
.
ASCIIEncoding
.
ASCII
.
GetBytes
(
pass
)
)
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
(
input
)
encrypted
=
Convert
.
ToBase64String
(
DESEncrypter
.
TransformFinalBlock
(
Buffer,
0
, Buffer
.
Length
)
)
Return
encrypted
Catch
ex
As
Exception
End
Try
End
Function
Código: vb.net
Public
Function
RC2_Decrypt
(
ByVal
input
As
String
,
ByVal
pass
As
String
)
As
String
Dim
RC2
As
New
System
.
Security
.
Cryptography
.
RC2CryptoServiceProvider
Dim
Hash_RC2
As
New
System
.
Security
.
Cryptography
.
MD5CryptoServiceProvider
Dim
decrypted
As
String
=
""
Try
Dim
hash
(
)
As
Byte
=
Hash_RC2
.
ComputeHash
(
System
.
Text
.
ASCIIEncoding
.
ASCII
.
GetBytes
(
pass
)
)
RC2
.
Key
=
hash
RC2
.
Mode
=
Security
.
Cryptography
.
CipherMode
.
ECB
Dim
DESDecrypter
As
System
.
Security
.
Cryptography
.
ICryptoTransform
=
RC2
.
CreateDecryptor
Dim
Buffer
As
Byte
(
)
=
Convert
.
FromBase64String
(
input
)
decrypted
=
System
.
Text
.
ASCIIEncoding
.
ASCII
.
GetString
(
DESDecrypter
.
TransformFinalBlock
(
Buffer,
0
, Buffer
.
Length
)
)
Return
decrypted
Catch
ex
As
Exception
End
Try
End
Function
TripleDES
Código: vb.net
Public
Function
TripleDES_Encrypt
(
ByVal
input
As
String
,
ByVal
pass
As
String
)
As
String
Dim
TripleDES
As
New
System
.
Security
.
Cryptography
.
TripleDESCryptoServiceProvider
Dim
Hash_TripleDES
As
New
System
.
Security
.
Cryptography
.
MD5CryptoServiceProvider
Dim
encrypted
As
String
=
""
Try
Dim
hash
(
23
)
As
Byte
Dim
temp
As
Byte
(
)
=
Hash_TripleDES
.
ComputeHash
(
System
.
Text
.
ASCIIEncoding
.
ASCII
.
GetBytes
(
pass
)
)
Array
.
Copy
(
temp,
0
, hash,
0
,
16
)
Array
.
Copy
(
temp,
0
, hash,
15
,
<
img src
=
"https://underc0de.org/foro/Smileys/default/cool.gif"
alt
=
"8)"
title
=
"Cool"
class
=
"smiley"
/>
TripleDES
.
Key
=
hash
TripleDES
.
Mode
=
Security
.
Cryptography
.
CipherMode
.
ECB
Dim
DESEncrypter
As
System
.
Security
.
Cryptography
.
ICryptoTransform
=
TripleDES
.
CreateEncryptor
Dim
Buffer
As
Byte
(
)
=
System
.
Text
.
ASCIIEncoding
.
ASCII
.
GetBytes
(
input
)
encrypted
=
Convert
.
ToBase64String
(
DESEncrypter
.
TransformFinalBlock
(
Buffer,
0
, Buffer
.
Length
)
)
Return
encrypted
Catch
ex
As
Exception
End
Try
End
Function
Código: vb.net
Public
Function
TripleDES_Decrypt
(
ByVal
input
As
String
,
ByVal
pass
As
String
)
As
String
Dim
TripleDES
As
New
System
.
Security
.
Cryptography
.
TripleDESCryptoServiceProvider
Dim
Hash_TripleDES
As
New
System
.
Security
.
Cryptography
.
MD5CryptoServiceProvider
Dim
decrypted
As
String
=
""
Try
Dim
hash
(
23
)
As
Byte
Dim
temp
As
Byte
(
)
=
Hash_TripleDES
.
ComputeHash
(
System
.
Text
.
ASCIIEncoding
.
ASCII
.
GetBytes
(
pass
)
)
Array
.
Copy
(
temp,
0
, hash,
0
,
16
)
Array
.
Copy
(
temp,
0
, hash,
15
,
<
img src
=
"https://underc0de.org/foro/Smileys/default/cool.gif"
alt
=
"8)"
title
=
"Cool"
class
=
"smiley"
/>
TripleDES
.
Key
=
hash
TripleDES
.
Mode
=
Security
.
Cryptography
.
CipherMode
.
ECB
Dim
DESDecrypter
As
System
.
Security
.
Cryptography
.
ICryptoTransform
=
TripleDES
.
CreateDecryptor
Dim
Buffer
As
Byte
(
)
=
Convert
.
FromBase64String
(
input
)
decrypted
=
System
.
Text
.
ASCIIEncoding
.
ASCII
.
GetString
(
DESDecrypter
.
TransformFinalBlock
(
Buffer,
0
, Buffer
.
Length
)
)
Return
decrypted
Catch
ex
As
Exception
End
Try
End
Function
XOR
Código: vb.net
Public
Function
XOR_Encrypt
(
ByVal
Input
As
String
,
ByVal
pass
As
String
)
As
String
Dim
out
As
New
System
.
Text
.
StringBuilder
Dim
u
As
Integer
For
i
As
Integer
=
0
To
Input
.
Length
-
1
Dim
tmp
As
String
=
Hex
(
Asc
(
Input
(
i
)
)
Xor
Asc
(
pass
(
u
)
)
)
If
tmp
.
Length
=
1
Then
tmp
=
"0"
&
tmp
out
.
Append
(
tmp
)
If
u
=
pass
.
Length
-
1
Then
u
=
0
Else
u
=
u
+
1
Next
Return
out
.
ToString
End
Function
Código: vb.net
Public
Function
XOR_Decrypt
(
ByVal
Input
As
String
,
ByVal
pass
As
String
)
As
String
Dim
out
As
New
System
.
Text
.
StringBuilder
Dim
u
As
Integer
For
i
As
Integer
=
0
To
Input
.
Length
-
1
Step
+
2
Dim
tmp
As
String
=
Chr
(
(
"&H"
&
Input
.
Substring
(
i,
2
)
)
Xor
Asc
(
pass
(
u
)
)
)
out
.
Append
(
tmp
)
If
u
=
pass
.
Length
-
1
Then
u
=
0
Else
u
=
u
+
1
Next
Return
out
.
ToString
End
Function
Creditos: pr0totip3
Fuente: Ax
Saludos
«
Última modificación: Enero 05, 2015, 09:55:26 am por Expermicid
»
En línea
Cronos
Ex-Staff
Mensajes: 1000
Actividad:
0%
Country:
Reputación 1
sudo su
Re:Encrypt&Decrypt (xor,des,rc2,tripleDES)
en: Junio 25, 2012, 12:22:30 am
Aportaso Expermicid!! Gracias por traerlos..
Saludos,, Cronos.-
En línea
@NetFcruz
Underc0der
Mensajes: 40
Actividad:
0%
Reputación 0
Re:Encrypt&Decrypt (xor,des,rc2,tripleDES)
en: Diciembre 22, 2012, 01:32:05 pm
Hola recien veo esto soy nuevo en este foro, pero pues mi duda es Encriptador y desencriptador cierto?. Ademas lo probare amigos.
Saludos.
En línea
System32
XD
Imprimir
Páginas: [
1
]
Ir Arriba
« anterior
próximo »
Similar topics (1)
[C#] Aes File Encrypt/Decrypt
Iniciado por
fudmario
Respuestas: 1
Vistas: 3601
Noviembre 10, 2016, 10:40:47 pm
por
Zentraedi
Sponsors
Zerpens
Kali-Linux
Club Hacker
ANTRAX-LABS
Ingresar
×
Bienvenido(a),
Visitante
. Por favor,
ingresa
o
regístrate
. ¿Perdiste tu
email de activación
?
1 Hora
1 Día
1 Semana
1 Mes
Siempre
Ingresar con nombre de usuario, contraseña y duración de la sesión