Advertisement
ZeekoSec

DENC

Nov 27th, 2015
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.76 KB | None | 0 0
  1. Imports System.Text 'Above Public Class
  2. '========================================================================================================
  3. Public Class StairsEncryption
  4. '========================================================================================================
  5.     Public Shared Function Crypt(ByVal Data As String, ByVal key As String) As String
  6.   Return Encoding.Default.GetString(Crypt(Encoding.Default.GetBytes(Data), Encoding.Default.GetBytes(key)))  
  7. End Function
  8. '========================================================================================================
  9.     Public Shared Function Crypt(ByVal Data() As Byte, ByVal key() As Byte) As Byte()
  10.   For i = 0 To (Data.Length * 2) + Key.Length
  11.     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)
  12.   Next
  13.   Return Data
  14.     End Function
  15. '========================================================================================================
  16.     Public Shared Function DeCrypt(ByVal Data As String, ByVal key As String) As String
  17.   Return Encoding.Default.GetString(DeCrypt(Encoding.Default.GetBytes(Data), Encoding.Default.GetBytes(key)))
  18.     End Function
  19. '========================================================================================================
  20.     Public Shared Function DeCrypt(ByVal Data() As Byte, ByVal key() As Byte) As Byte()
  21.   For i = (Data.Length * 2) + Key.Length To 0 Step -1
  22.     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)
  23.   Next
  24.   Return Data
  25.     End Function
  26. '========================================================================================================
  27. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement