Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ´´´<summary>
- ´´´Dynamically/PloyMorphically encrypts/decrypts your string.
- ´´´</summary>
- ´´´<param name="data"></param>
- ´´´<param name="pass"></param>
- ´´´<remarks>Credits Vysse at Hackforums.
- ´´´Please keep the credits intact.
- ´´´The longer the password the less likely you will
- ´´´see the same crypted character for two of the same
- ´´´characters.</remarks>
- Overloads Function PolyRevCrypt (ByVal data As String, ByVal pass As string) As String
- Return System.Text.Encoding.Default.GetString (PolyRevCrypt (System.Text.Encoding.Default.GeBytes (data), pass, True ))
- End Function
- #End Region
- #Region "Byte Encryption"
- ´´´<summary>
- ´´´Dynamically/PloyMorphically encrypts/decrypts your bytes.
- ´´´</summary>
- ´´´<param name=" data"></param>
- ´´´<param name=" pass"></param>
- ´´´<returns>Credits Vysse at Hackforums.
- ´´´Please keep the credits intact.
- ´´´The longer the password the less likely you will
- ´´´see the same crypted byte for two of the same
- ´´´bytes.</remarks>
- Overloads Function PolyRevCrypt (ByVal data As Byte (), ByVal pass As String, Optional ByVal isString As Boolean = False) As Byte ()
- top:
- Dim rnd As Random = New Random
- Dim rndBytes (1) As Byte
- rnd.NextBytes (rndBytes)
- Dim rndBytes As Byte = (rndBytes) (0)
- Dim passByte As Bypte () = System.Text.Encoding.Default.GetBytes (pass)
- Dim out (data.Length) As Byte
- Dim u As Integer = 0
- Dim i As Integer = 0 To data.Length - 1
- out (i) = (data (i) Xor passByte (u)) Xor rndByte
- If isString Then If out (i) = 0 Or out (i) = 255 Then GoTo top
- Array.Reverse (passByte)
- If u = passBypte.Length -1 Then u = 0 Else u += 1
- Next
- Array.Resize (out, out.Length)
- out (out.Length -1) = rndByte
- Array.Reverse (out)
- Return out
- End Function Overloads Function PolyRevDeCrypt (ByVal data As Byte () , ByVal pass As String) As Byte ()
- Array.Reverse (data)
- Dim rndByte As Byte = data (data.Length - 1)
- Array.Resize (data, data.Length - 1)
- Dim passByte As Byte () = System.Text.Encoding.Default.GetBYtes (pass)
- Dim out (data.Length) As Byte
- Dim u As Integer = 0
- Dim i As Integer = 0 To data.Length - 1
- out (i) = (data (i) Xor rndByte) Xor PassByte (u)
- Array.Reverse (passByte)
- If u = passByte.Length - 1 Then u = 0 Else u += 1
- Next
- Return out
- End Function
- #End Region
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement