comment
IRC Chat
play_arrow
Este sitio utiliza cookies propias y de terceros. Si continúa navegando consideramos que acepta el uso de cookies. OK Más Información.

Encrypt&Decrypt (xor,des,rc2,tripleDES)

  • 2 Respuestas
  • 3112 Vistas

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado Expermicid

  • *
  • Underc0der
  • Mensajes: 457
  • Actividad:
    0%
  • Reputación 0
  • _-Expermicid-_
    • Ver Perfil
  • Skype: expermicid.xd
« en: Junio 25, 2012, 12:18:37 am »
DES

Código: vb.net
  1. Public Function DES_Encrypt(ByVal input As String, ByVal pass As String) As String
  2.         Dim DES As New System.Security.Cryptography.DESCryptoServiceProvider
  3.         Dim Hash_DES As New System.Security.Cryptography.MD5CryptoServiceProvider
  4.         Dim encrypted As String = ""
  5.         Try
  6.             Dim hash(7) As Byte
  7.             Dim temp As Byte() = Hash_DES.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(pass))
  8.             Array.Copy(temp, 0, hash, 0, 8)
  9.             DES.Key = hash
  10.             DES.Mode = Security.Cryptography.CipherMode.ECB
  11.             Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = DES.CreateEncryptor
  12.             Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(Input)
  13.             encrypted = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
  14.             Return encrypted
  15.         Catch ex As Exception
  16.         End Try
  17.     End Function
Código: vb.net
  1. Public Function DES_Decrypt(ByVal input As String, ByVal pass As String) As String
  2.         Dim DES As New System.Security.Cryptography.DESCryptoServiceProvider
  3.         Dim Hash_DES As New System.Security.Cryptography.MD5CryptoServiceProvider
  4.         Dim decrypted As String = ""
  5.         Try
  6.             Dim hash(7) As Byte
  7.             Dim temp As Byte() = Hash_DES.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(pass))
  8.             Array.Copy(temp, 0, hash, 0, 8)
  9.             DES.Key = hash
  10.             DES.Mode = Security.Cryptography.CipherMode.ECB
  11.             Dim DESDecrypter As System.Security.Cryptography.ICryptoTransform = DES.CreateDecryptor
  12.             Dim Buffer As Byte() = Convert.FromBase64String(input)
  13.             decrypted = System.Text.ASCIIEncoding.ASCII.GetString(DESDecrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
  14.             Return decrypted
  15.         Catch ex As Exception
  16.         End Try
  17.     End Function

RC2

Código: vb.net
  1. Public Function RC2_Encrypt(ByVal input As String, ByVal pass As String) As String
  2.         Dim RC2 As New System.Security.Cryptography.RC2CryptoServiceProvider
  3.         Dim Hash_RC2 As New System.Security.Cryptography.MD5CryptoServiceProvider
  4.         Dim encrypted As String = ""
  5.         Try
  6.             Dim hash() As Byte = Hash_RC2.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(pass))
  7.            
  8.             RC2.Key = hash
  9.             RC2.Mode = Security.Cryptography.CipherMode.ECB
  10.             Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = RC2.CreateEncryptor
  11.             Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(input)
  12.             encrypted = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
  13.             Return encrypted
  14.         Catch ex As Exception
  15.         End Try
  16.     End Function
Código: vb.net
  1. Public Function RC2_Decrypt(ByVal input As String, ByVal pass As String) As String
  2.         Dim RC2 As New System.Security.Cryptography.RC2CryptoServiceProvider
  3.         Dim Hash_RC2 As New System.Security.Cryptography.MD5CryptoServiceProvider
  4.         Dim decrypted As String = ""
  5.         Try
  6.               Dim hash() As Byte = Hash_RC2.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(pass))
  7.             RC2.Key = hash
  8.             RC2.Mode = Security.Cryptography.CipherMode.ECB
  9.             Dim DESDecrypter As System.Security.Cryptography.ICryptoTransform = RC2.CreateDecryptor
  10.             Dim Buffer As Byte() = Convert.FromBase64String(input)
  11.             decrypted = System.Text.ASCIIEncoding.ASCII.GetString(DESDecrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
  12.             Return decrypted
  13.         Catch ex As Exception
  14.         End Try
  15.     End Function

TripleDES

Código: vb.net
  1. Public Function TripleDES_Encrypt(ByVal input As String, ByVal pass As String) As String
  2.         Dim TripleDES As New System.Security.Cryptography.TripleDESCryptoServiceProvider
  3.         Dim Hash_TripleDES As New System.Security.Cryptography.MD5CryptoServiceProvider
  4.         Dim encrypted As String = ""
  5.         Try
  6.             Dim hash(23) As Byte
  7.             Dim temp As Byte() = Hash_TripleDES.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(pass))
  8.             Array.Copy(temp, 0, hash, 0, 16)
  9.             Array.Copy(temp, 0, hash, 15, 8)
  10.             TripleDES.Key = hash
  11.             TripleDES.Mode = Security.Cryptography.CipherMode.ECB
  12.             Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = TripleDES.CreateEncryptor
  13.             Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(input)
  14.             encrypted = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
  15.             Return encrypted
  16.         Catch ex As Exception
  17.         End Try
  18.     End Function
Código: vb.net
  1. Public Function TripleDES_Decrypt(ByVal input As String, ByVal pass As String) As String
  2.         Dim TripleDES As New System.Security.Cryptography.TripleDESCryptoServiceProvider
  3.         Dim Hash_TripleDES As New System.Security.Cryptography.MD5CryptoServiceProvider
  4.         Dim decrypted As String = ""
  5.         Try
  6.             Dim hash(23) As Byte
  7.             Dim temp As Byte() = Hash_TripleDES.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(pass))
  8.             Array.Copy(temp, 0, hash, 0, 16)
  9.             Array.Copy(temp, 0, hash, 15, 8)
  10.             TripleDES.Key = hash
  11.             TripleDES.Mode = Security.Cryptography.CipherMode.ECB
  12.             Dim DESDecrypter As System.Security.Cryptography.ICryptoTransform = TripleDES.CreateDecryptor
  13.             Dim Buffer As Byte() = Convert.FromBase64String(input)
  14.             decrypted = System.Text.ASCIIEncoding.ASCII.GetString(DESDecrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
  15.             Return decrypted
  16.         Catch ex As Exception
  17.         End Try
  18.     End Function

XOR

Código: vb.net
  1. Public Function XOR_Encrypt(ByVal Input As String, ByVal pass As String) As String
  2.         Dim out As New System.Text.StringBuilder
  3.         Dim u As Integer
  4.         For i As Integer = 0 To Input.Length - 1
  5.             Dim tmp As String = No tienes permisos para ver links. Registrate o Entra con tu cuenta(No tienes permisos para ver links. Registrate o Entra con tu cuenta(Input(i)) Xor No tienes permisos para ver links. Registrate o Entra con tu cuenta(pass(u)))
  6.             If tmp.Length = 1 Then tmp = "0" & tmp
  7.             out.Append(tmp)
  8.             If u = pass.Length - 1 Then u = 0 Else u = u + 1
  9.         Next
  10.         Return out.ToString
  11.     End Function
Código: vb.net
  1. Public Function XOR_Decrypt(ByVal Input As String, ByVal pass As String) As String
  2.         Dim out As New System.Text.StringBuilder
  3.         Dim u As Integer
  4.         For i As Integer = 0 To Input.Length - 1 Step +2
  5.             Dim tmp As String = No tienes permisos para ver links. Registrate o Entra con tu cuenta(("&H" & Input.Substring(i, 2)) Xor No tienes permisos para ver links. Registrate o Entra con tu cuenta(pass(u)))
  6.             out.Append(tmp)
  7.             If u = pass.Length - 1 Then u = 0 Else u = u + 1
  8.         Next
  9.         Return out.ToString
  10.     End Function

Creditos: pr0totip3
Fuente: Ax

Saludos
« Última modificación: Enero 05, 2015, 09:55:26 am por Expermicid »

Desconectado Cronos

  • *
  • Underc0der
  • Mensajes: 1000
  • Actividad:
    0%
  • Reputación 1
  • Mientras mas se, me doy cuenta de lo poco que se.
    • Ver Perfil
    • Email
  • Skype: cronos.labs
« Respuesta #1 en: Junio 25, 2012, 12:22:30 am »
Aportaso Expermicid!! Gracias por traerlos..
Saludos,, Cronos.-

Desconectado @NetFcruz

  • *
  • Underc0der
  • Mensajes: 40
  • Actividad:
    0%
  • Reputación 0
    • Ver Perfil
    • Email
« Respuesta #2 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. :D
System32
XD
No tienes permisos para ver links. Registrate o Entra con tu cuenta

 

¿Te gustó el post? COMPARTILO!



[C#] Aes File Encrypt/Decrypt

Iniciado por fudmario

Respuestas: 1
Vistas: 2316
Último mensaje Noviembre 10, 2016, 10:40:47 pm
por Zentraedi