Bueno,
Dado que hay varios tipos/variantes de ROT, he decidido hacer una genérica (César, ROT5, ROT13, ROT47...).

Código: Seleccionar todo

'Simple ROT N (Encriptación Modular)
'Autor: Slek
'Para Indetectables.net
'18/07/10
'Ejemplo de uso: Text2.Text = EncROTN(Text1.Text, 47)

Function EncROTN(sStr As String, Num As Long) As String
Dim bA() As Byte

bA = StrConv(sStr, vbFromUnicode)

For i = 0 To UBound(bA)
    bA(i) = (bA(i) + Num) Mod 256
Next i

EncROTN = StrConv(bA(), vbUnicode)
End Function

Function DecROTN(sStr As String, Num As Long) As String
Dim bA() As Byte

bA = StrConv(sStr, vbFromUnicode)

For i = 0 To UBound(bA)
    bA(i) = (bA(i) + (256 - Num)) Mod 256
Next i

DecROTN = StrConv(bA(), vbUnicode)
End Function
Saludos!
github.com/Slek-Z
El Numb con que fín ? , para encryptar en cadenas muy largas? me imagino que sera
como una XOR, que con la misma que encryptas, desencryptas.. no?
Imagen

http://img844.imageshack.us/img844/8088/mujerrara.jpg
http://img715.imageshack.us/img715/5813/tigree.png
http://img830.imageshack.us/img830/6484/camaleon.png

http://img839.imageshack.us/img839/4944/tigrev2.jpg
http://img843.imageshack.us/img843/443/spidermanxn.png

http://www.youtube.com/watch?v=wHYYkciIKE0
Más o menos. Pero es ROT, osea que suma, y para desencriptar resta.
El Num es el NUMero a añadir. Si quierer encriptar/desencriptar en ROT13, pues usas 13 como Num.
Por ejemplo: Text2.Text = EncROTN(Text1.Text, 13)
Si quieres césar, pues Text2.Text = EncROTN(Text1.Text, 3)
si quieres ROT47 Text2.Text = EncROTN(Text1.Text, 47)
Si quieres crearte una encriptación tipo ROT pues por ejemplo
Text2.Text = EncROTN(Text1.Text, 25)

No solo encripta String, Está pensada para encriptar Bytes, y no string (por el Mod 256)

Gracias por comentar jeje

Saludos!
github.com/Slek-Z
Ahhh migo.. vale vale, ahora entonces es mucho más curro del que yo pensaba..
Si señor, muy buena Sleek !
Imagen

http://img844.imageshack.us/img844/8088/mujerrara.jpg
http://img715.imageshack.us/img715/5813/tigree.png
http://img830.imageshack.us/img830/6484/camaleon.png

http://img839.imageshack.us/img839/4944/tigrev2.jpg
http://img843.imageshack.us/img843/443/spidermanxn.png

http://www.youtube.com/watch?v=wHYYkciIKE0
no declaras la variable i ...puede ocasionar problemas , de eso lo demas esta bien , voy a ver si hago una , salu2
Responder

Volver a “Otros lenguajes”