Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. ´´´<summary>
  2. ´´´Dynamically/PloyMorphically encrypts/decrypts your string.
  3. ´´´</summary>
  4. ´´´<param name="data"></param>
  5. ´´´<param name="pass"></param>
  6. ´´´<remarks>Credits Vysse at Hackforums.
  7. ´´´Please keep the credits intact.
  8. ´´´The longer the password the less likely you will
  9. ´´´see the same crypted character for two of the same
  10. ´´´characters.</remarks>
  11. Overloads Function PolyRevCrypt (ByVal data As String, ByVal pass As string) As String
  12. Return System.Text.Encoding.Default.GetString (PolyRevCrypt (System.Text.Encoding.Default.GeBytes (data), pass, True ))
  13. End Function
  14. #End Region
  15. #Region "Byte Encryption"
  16. ´´´<summary>
  17. ´´´Dynamically/PloyMorphically encrypts/decrypts your bytes.
  18. ´´´</summary>
  19. ´´´<param name=" data"></param>
  20. ´´´<param name=" pass"></param>
  21. ´´´<returns>Credits Vysse at Hackforums.
  22. ´´´Please keep the credits intact.
  23. ´´´The longer the password the less likely you will
  24. ´´´see the same crypted byte for two of the same
  25. ´´´bytes.</remarks>
  26. Overloads Function PolyRevCrypt (ByVal data As Byte (), ByVal pass As String, Optional ByVal isString As Boolean = False) As Byte ()
  27. top:
  28. Dim rnd As Random = New Random
  29. Dim rndBytes (1) As Byte
  30. rnd.NextBytes (rndBytes)
  31. Dim rndBytes As Byte = (rndBytes) (0)
  32. Dim passByte As Bypte () = System.Text.Encoding.Default.GetBytes (pass)
  33. Dim out (data.Length) As Byte
  34. Dim u As Integer = 0
  35. Dim i As Integer = 0 To data.Length - 1
  36. out (i) = (data (i) Xor passByte (u)) Xor rndByte
  37. If isString Then If out (i) = 0 Or out (i) = 255 Then GoTo top
  38. Array.Reverse (passByte)
  39. If u = passBypte.Length -1 Then u = 0 Else u += 1
  40. Next
  41. Array.Resize (out, out.Length)
  42. out (out.Length -1) = rndByte
  43. Array.Reverse (out)
  44. Return out
  45. End Function Overloads Function PolyRevDeCrypt (ByVal data As Byte () , ByVal pass As String) As Byte ()
  46. Array.Reverse (data)
  47. Dim rndByte As Byte = data (data.Length - 1)
  48. Array.Resize (data, data.Length - 1)
  49. Dim passByte As Byte () = System.Text.Encoding.Default.GetBYtes (pass)
  50. Dim out (data.Length) As Byte
  51. Dim u As Integer = 0
  52. Dim i As Integer = 0 To data.Length - 1
  53. out (i) = (data (i) Xor rndByte) Xor PassByte (u)
  54. Array.Reverse (passByte)
  55. If u = passByte.Length - 1 Then u = 0 Else u += 1
  56. Next
  57. Return out
  58. End Function
  59. #End Region
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement