Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

[C#][VB.NET][SRC]Polymorphic Encryption Class

Hey nice share I was looking for something like this to understand how it works. Thanks.
work very good
vb.net if s1 want
Code
Class PolyEncryption
    Public Function EncryptText(ByVal input As String, ByVal key As String) As String

  'This function Polymorphically encrypts the entered Text, utilising a Key and Salt.
  'All credits to Ethereal of HackForums.net
  'Please leave the credits.
  Dim R As New Random()
  Dim kc As Integer = 0
  Dim text As Char() = input.ToCharArray()
  Dim keyarr As Char() = key.ToCharArray()
  Dim FinVal As Char() = New Char(input.Length) {}
  Dim Rnd As Integer = R.[Next](100, 220)
  For index As Integer = 0 To input.Length - 1
    If kc >= keyarr.Length Then
    kc = 0
    End If

    Dim ptVal As Integer = AscW(text(index))
    Dim kVal As Integer = AscW(keyarr(kc))
    Dim ciVal As Integer = ptVal + kVal + Rnd
    FinVal(index) = Convert.ToChar(ciVal)
    kc += 1
  Next
  FinVal(input.Length) = ChrW(Rnd)
  Dim RetStr As New String(FinVal)
  Return RetStr

    End Function

    Public Function DecryptText(ByVal input As String, ByVal key As String) As String

  'This function decrypts text that was encrypted with the Polymorphic encrypter in this class.
  'All credits to Ethereal of HackForums.net
  'Please leave the credits.
  Dim text As Char() = input.ToCharArray()
  Dim keyarr As Char() = key.ToCharArray()
  Dim FinVal As Char() = New Char(input.Length - 2) {}
  Dim RndKVal As Integer = AscW(text(input.Length - 1))
  text(input.Length - 1) = ControlChars.NullChar
  Dim kc As Integer = 0
  For index As Integer = 0 To input.Length - 1
    If index >= input.Length - 1 Then
    Continue For
    End If
    If kc >= keyarr.Length Then
    kc = 0
    End If
    Dim ciVal As Integer = AscW(text(index))
    Dim kVal As Integer = AscW(keyarr(kc))
    Dim ptVal As Integer = ciVal - RndKVal - kVal
    FinVal(index) = Convert.ToChar(ptVal)
    kc += 1
  Next
  Dim RetStr As New String(FinVal)
  Return RetStr
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  TextBox1.Text = EncryptText(TextBox1.Text, TextBox3.Text)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  TextBox2.Text = DecryptText(TextBox1.Text, TextBox3.Text)
    End Sub
End Class
tnx
Thanks for the share!
I understood how the encryption works,but there is still one thing I couldn't catch...
I have tried to understand for weeks now,but with no results...

I hope that you Etheral (or anybody else...) will clearify what I need to know!

Once I crypt an API,for example
Public shared Function Writeprocessmemory (lol,random Api lol) etc etc...

It will become unreadable,something like this:

Ghfrty FDEgtbjg GHFDGGTG JJGFFHJJJHF%G etc etc....

Of course I will get an error...
I need a way to decrypt the Api runtime.
I don't really know how to explain this....somehow I need that instead of getting an error ,the Api gets decrypted before beeing read and cause the error...
Maybe the best way is CreateApi and then just crypting "Kernel.dll" and "WriteProcessMemory" when I declare a Variable?

Please help me to bypass this problem ,because I can't by myself ;(


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by PELockApr 14, 2026 01:15 PM 0 126 Apr 14, 2026 01:15 PM
Last Post: PELock
[Shell] by PELockDec 9, 2024 09:42 AM 3 657 Dec 9, 2024 09:42 AM
Last Post: PELock
[C#] by indetectableFeb 4, 2022 07:52 AM 3 313 Feb 4, 2022 07:52 AM
Last Post: yvnkxx