Şifreleme Modülleri [ vb.net ]

Maveraün Nehr

Blue Expert / Head of Malware Team
25 Haz 2021
976
1,865
41.303921, -81.901693
Source undetected için bazı şifreleme modülleri aşağıdadır. Kodlar şahsıma ait değildir.

Foruma 3 adet textbox ve bir adet buton ekleyelim. Tüm şifreleme sistemleri için geçerlidir.
Textbox'larımızın isimlerini veri, key, sonuç olarak değiştirelim. Cryptography kütüphanemizi Import etmeyi unutmayalım. :)

Sezar Şifreleme Modülü:

Kod:
Private Shared Function Cipher(ch As Char, key As Integer) As Char
    If Not Char.IsLetter(ch) Then
        Return ch
    End If
    Dim offset As Integer = Convert.ToInt32(If(Char.IsUpper(ch), "A"c, "a"c))
    Return ChrW((((Convert.ToInt32(ch) + key) - offset) Mod 26) + offset)
End Function
Public Shared Function Encipher(input As String, key As Integer) As String
    Dim output As String = String.Empty
    For Each ch As Char In input
        output += Cipher(ch, key)
    Next
    Return output
End Function
Public Shared Function Decipher(input As String, key As Integer) As String
    Return Encipher(input, 26 - key)
End Function

Çözüm:

sonuç.Text = Encipher(veri.Text, key.Text) 'key kısmına 0'dan 9'a kadar sayı yazabiliriz harf girerse hata veriyor. Bu arada burası şifreler :)
sonuç.Text = Decipher(veri.Text, key.Text) 'Çözer

AES Şifreleme Modülü:

Kod:
 Public Function AES_Encrypt(ByVal input As String, ByVal pass As String) As String
        Dim AES As New System.Security.Cryptography.RijndaelManaged
        Dim Hash_AES As New System.Security.Cryptography.MD5CryptoServiceProvider
        Dim encrypted As String = ""
        Try
            Dim hash(31) As Byte
            Dim temp As Byte() = Hash_AES.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(pass))
            Array.Copy(temp, 0, hash, 0, 16)
            Array.Copy(temp, 0, hash, 15, 16)
            AES.Key = hash
            AES.Mode = Security.Cryptography.CipherMode.ECB
            Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = AES.CreateEncryptor
            Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(input)
            encrypted = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
            Return encrypted
        Catch ex As Exception
        End Try
    End Function
    Public Function AES_Decrypt(ByVal input As String, ByVal pass As String) As String
        Dim AES As New System.Security.Cryptography.RijndaelManaged
        Dim Hash_AES As New System.Security.Cryptography.MD5CryptoServiceProvider
        Dim decrypted As String = ""
        Try
            Dim hash(31) As Byte
            Dim temp As Byte() = Hash_AES.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(pass))
            Array.Copy(temp, 0, hash, 0, 16)
            Array.Copy(temp, 0, hash, 15, 16)
            AES.Key = hash
            AES.Mode = Security.Cryptography.CipherMode.ECB
            Dim DESDecrypter As System.Security.Cryptography.ICryptoTransform = AES.CreateDecryptor
            Dim Buffer As Byte() = Convert.FromBase64String(input)
            decrypted = System.Text.ASCIIEncoding.ASCII.GetString(DESDecrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
            Return decrypted
        Catch ex As Exception
        End Try
    End Function

Çözüm:

sonuç.Text = AES_Encrypt(veri.Text, key.Text) 'Şifreler
sonuç.Text =AES_Decrypt(veri.Text, key.Text) 'Çözer

RC4 Şifreleme Modülü:

Kod:
 Public Shared Function rc4(ByVal message As String, ByVal password As String) As String
        Dim i As Integer = 0
        Dim j As Integer = 0
        Dim cipher As New StringBuilder
        Dim returnCipher As String = String.Empty
        Dim sbox As Integer() = New Integer(256) {}
        Dim key As Integer() = New Integer(256) {}
        Dim intLength As Integer = password.Length
        Dim a As Integer = 0
        While a <= 255
            Dim ctmp As Char = (password.Substring((a Mod intLength), 1).ToCharArray()(0))
            key(a) = Microsoft.VisualBasic.Strings.Asc(ctmp)
            sbox(a) = a
            System.Math.Max(System.Threading.Interlocked.Increment(a), a - 1)
        End While
        Dim x As Integer = 0
        Dim b As Integer = 0
        While b <= 255
            x = (x + sbox(b) + key(b)) Mod 256
            Dim tempSwap As Integer = sbox(b)
            sbox(b) = sbox(x)
            sbox(x) = tempSwap
            System.Math.Max(System.Threading.Interlocked.Increment(b), b - 1)
        End While
        a = 1
        While a <= message.Length
            Dim itmp As Integer = 0
            i = (i + 1) Mod 256
            j = (j + sbox(i)) Mod 256
            itmp = sbox(i)
            sbox(i) = sbox(j)
            sbox(j) = itmp
            Dim k As Integer = sbox((sbox(i) + sbox(j)) Mod 256)
            Dim ctmp As Char = message.Substring(a - 1, 1).ToCharArray()(0)
            itmp = Asc(ctmp)
            Dim cipherby As Integer = itmp Xor k
            cipher.Append(Chr(cipherby))
            System.Math.Max(System.Threading.Interlocked.Increment(a), a - 1)
        End While
        returnCipher = cipher.ToString
        cipher.Length = 0
        Return returnCipher
    End Function

Çözüm:
sonuç.Text = rc4(veri.Text, key.Text)


x0r Şifreleme Modülü:

Kod:
Public Shared Function XORCipher(data As String, key As String) As String
        Dim dataLen As Integer = data.Length
        Dim keyLen As Integer = key.Length
        Dim output As Char() = New Char(dataLen - 1) {}
        For i As Integer = 0 To dataLen - 1
            output(i) = ChrW(Asc(data(i)) Xor Asc(key(i Mod keyLen)))
        Next
        Return New String(output)
    End Function

Çözüm:
sonuç.Text = XORCipher(veri.Text, key.Text)


Playfair Şifreleme Modülü:

Kod:
Private Shared Function [Mod](a As Integer, b As Integer) As Integer
    Return (a Mod b + b) Mod b
End Function
Private Shared Function FindAllOccurrences(str As String, value As Char) As List(Of Integer)
    Dim indexes As New List(Of Integer)()
    Dim index As Integer = 0
    While index <> -1
        index = str.IndexOf(value, index)
        If index <> -1 Then
            indexes.Add(index)
            index += 1
        End If
    End While
    Return indexes
End Function
Private Shared Function RemoveAllDuplicates(str As String, indexes As List(Of Integer)) As String
    Dim retVal As String = str
    For i As Integer = indexes.Count - 1 To 1 Step -1
        retVal = retVal.Remove(indexes(i), 1)
    Next
    Return retVal
End Function
Private Shared Function GenerateKeySquare(key As String) As Char(,)
    Dim keySquare As Char(,) = New Char(4, 4) {}
    Dim defaultKeySquare As String = "ABCDEFGHIKLMNOPQRSTUVWXYZ"
    Dim tempKey As String = If(String.IsNullOrEmpty(key), "CIPHER", key.ToUpper())
    tempKey = tempKey.Replace("J", "")
    tempKey += defaultKeySquare
    For i As Integer = 0 To 24
        Dim indexes As List(Of Integer) = FindAllOccurrences(tempKey, defaultKeySquare(i))
        tempKey = RemoveAllDuplicates(tempKey, indexes)
    Next
    tempKey = tempKey.Substring(0, 25)
    For i As Integer = 0 To 24
        keySquare((i \ 5), (i Mod 5)) = tempKey(i)
    Next
    Return keySquare
End Function
Private Shared Sub GetPosition(ByRef keySquare As Char(,), ch As Char, ByRef row As Integer, ByRef col As Integer)
    If ch = "J"c Then
        GetPosition(keySquare, "I"c, row, col)
    End If
    For i As Integer = 0 To 4
        For j As Integer = 0 To 4
            If keySquare(i, j) = ch Then
                row = i
                col = j
            End If
        Next
    Next
End Sub
Private Shared Function SameRow(ByRef keySquare As Char(,), row As Integer, col1 As Integer, col2 As Integer, encipher As Integer) As Char()
    Return New Char() {keySquare(row, [Mod]((col1 + encipher), 5)), keySquare(row, [Mod]((col2 + encipher), 5))}
End Function
Private Shared Function SameColumn(ByRef keySquare As Char(,), col As Integer, row1 As Integer, row2 As Integer, encipher As Integer) As Char()
    Return New Char() {keySquare([Mod]((row1 + encipher), 5), col), keySquare([Mod]((row2 + encipher), 5), col)}
End Function
Private Shared Function SameRowColumn(ByRef keySquare As Char(,), row As Integer, col As Integer, encipher As Integer) As Char()
    Return New Char() {keySquare([Mod]((row + encipher), 5), [Mod]((col + encipher), 5)), keySquare([Mod]((row + encipher), 5), [Mod]((col + encipher), 5))}
End Function
Private Shared Function DifferentRowColumn(ByRef keySquare As Char(,), row1 As Integer, col1 As Integer, row2 As Integer, col2 As Integer) As Char()
    Return New Char() {keySquare(row1, col2), keySquare(row2, col1)}
End Function
Private Shared Function RemoveOtherChars(input As String) As String
    Dim output As String = input
    Dim i As Integer = 0
    While i < output.Length
        If Not Char.IsLetter(output(i)) Then
            output = output.Remove(i, 1)
        End If
        i += 1
    End While
    Return output
End Function
Private Shared Function AdjustOutput(input As String, output As String) As String
    Dim retVal As New StringBuilder(output)
    For i As Integer = 0 To input.Length - 1
        If Not Char.IsLetter(input(i)) Then
            retVal = retVal.Insert(i, input(i).ToString())
        End If
        If Char.IsLower(input(i)) Then
            retVal(i) = Char.ToLower(retVal(i))
        End If
    Next
    Return retVal.ToString()
End Function

Private Shared Function Cipher(input As String, key As String, encipher As Boolean) As String
    Dim retVal As String = String.Empty
    Dim keySquare As Char(,) = GenerateKeySquare(key)
    Dim tempInput As String = RemoveOtherChars(input)
    Dim e As Integer = If(encipher, 1, -1)
    If (tempInput.Length Mod 2) <> 0 Then
        tempInput += "X"
    End If
    For i As Integer = 0 To tempInput.Length - 1 Step 2
        Dim row1 As Integer = 0
        Dim col1 As Integer = 0
        Dim row2 As Integer = 0
        Dim col2 As Integer = 0
        GetPosition(keySquare, Char.ToUpper(tempInput(i)), row1, col1)
        GetPosition(keySquare, Char.ToUpper(tempInput(i + 1)), row2, col2)
        If row1 = row2 AndAlso col1 = col2 Then
            retVal += New String(SameRowColumn(keySquare, row1, col1, e))
        ElseIf row1 = row2 Then
            retVal += New String(SameRow(keySquare, row1, col1, col2, e))
        ElseIf col1 = col2 Then
            retVal += New String(SameColumn(keySquare, col1, row1, row2, e))
        Else
            retVal += New String(DifferentRowColumn(keySquare, row1, col1, row2, col2))
        End If
    Next
    retVal = AdjustOutput(input, retVal)
    Return retVal
End Function
Public Shared Function Encipher(input As String, key As String) As String
    Return Cipher(input, key, True)
End Function
Public Shared Function Decipher(input As String, key As String) As String
    Return Cipher(input, key, False)
End Function

Çözüm:

sonuç.Text = Encipher(veri.Text, key.Text) 'şifreler :)
sonuç.Text = Decipher(veri.Text, key.Text) 'Çözer

Vigenere Şifreleme Modülü:

Kod:
Private Shared Function [Mod](a As Integer, b As Integer) As Integer
    Return (a Mod b + b) Mod b
End Function
Private Shared Function Cipher(input As String, key As String, encipher As Boolean) As String
    For i As Integer = 0 To key.Length - 1
        If Not Char.IsLetter(key(i)) Then
            Return Nothing ' Error
        End If
    Next
    Dim output As String = String.Empty
    Dim nonAlphaCharCount As Integer = 0
    For i As Integer = 0 To input.Length - 1
        If Char.IsLetter(input(i)) Then
            Dim cIsUpper As Boolean = Char.IsUpper(input(i))
            Dim offset As Integer = Convert.ToInt32(If(cIsUpper, "A"c, "a"c))
            Dim keyIndex As Integer = (i - nonAlphaCharCount) Mod key.Length
            Dim k As Integer = Convert.ToInt32(If(cIsUpper, Char.ToUpper(key(keyIndex)), Char.ToLower(key(keyIndex)))) - offset
            k = If(encipher, k, -k)
            Dim ch As Char = ChrW(([Mod](((Convert.ToInt32(input(i)) + k) - offset), 26)) + offset)
            output += ch
        Else
            output += input(i)
            nonAlphaCharCount += 1
        End If
    Next
    Return output
End Function
Public Shared Function Encipher(input As String, key As String) As String
    Return Cipher(input, key, True)
End Function
Public Shared Function Decipher(input As String, key As String) As String
    Return Cipher(input, key, False)
End Function

Çözüm:

sonuç.Text = Encipher(veri.Text, key.Text) 'şifreler :)
sonuç.Text = Decipher(veri.Text, key.Text) 'Çözer

SHA256 Şifreleme Modülü:

Kod:
Private Shared Sub DBL_INT_ADD(ByRef a As UInteger, ByRef b As UInteger, c As UInteger)
    If a > &HFFFFFFFFUI - c Then
        b += 1
    End If
    a += c
End Sub
Private Shared Function ROTLEFT(a As UInteger, b As Byte) As UInteger
    Return ((a << b) Or (a >> (32 - b)))
End Function
Private Shared Function ROTRIGHT(a As UInteger, b As Byte) As UInteger
    Return (((a) >> (b)) Or ((a) << (32 - (b))))
End Function
Private Shared Function CH(x As UInteger, y As UInteger, z As UInteger) As UInteger
    Return (((x) And (y)) Xor (Not (x) And (z)))
End Function
Private Shared Function MAJ(x As UInteger, y As UInteger, z As UInteger) As UInteger
    Return (((x) And (y)) Xor ((x) And (z)) Xor ((y) And (z)))
End Function
Private Shared Function EP0(x As UInteger) As UInteger
    Return (ROTRIGHT(x, 2) Xor ROTRIGHT(x, 13) Xor ROTRIGHT(x, 22))
End Function
Private Shared Function EP1(x As UInteger) As UInteger
    Return (ROTRIGHT(x, 6) Xor ROTRIGHT(x, 11) Xor ROTRIGHT(x, 25))
End Function
Private Shared Function SIG0(x As UInteger) As UInteger
    Return (ROTRIGHT(x, 7) Xor ROTRIGHT(x, 18) Xor ((x) >> 3))
End Function
Private Shared Function SIG1(x As UInteger) As UInteger
    Return (ROTRIGHT(x, 17) Xor ROTRIGHT(x, 19) Xor ((x) >> 10))
End Function
Private Structure SHA256_CTX
    Public data As Byte()
    Public datalen As UInteger
    Public bitlen As UInteger()
    Public state As UInteger()
End Structure
Shared k As UInteger() = {&H428A2F98, &H71374491, &HB5C0FBCFUI, &HE9B5DBA5UI, &H3956C25B, &H59F111F1,
        &H923F82A4UI, &HAB1C5ED5UI, &HD807AA98UI, &H12835B01, &H243185BE, &H550C7DC3,
        &H72BE5D74, &H80DEB1FEUI, &H9BDC06A7UI, &HC19BF174UI, &HE49B69C1UI, &HEFBE4786UI,
        &HFC19DC6, &H240CA1CC, &H2DE92C6F, &H4A7484AA, &H5CB0A9DC, &H76F988DA,
        &H983E5152UI, &HA831C66DUI, &HB00327C8UI, &HBF597FC7UI, &HC6E00BF3UI, &HD5A79147UI,
        &H6CA6351, &H14292967, &H27B70A85, &H2E1B2138, &H4D2C6DFC, &H53380D13,
        &H650A7354, &H766A0ABB, &H81C2C92EUI, &H92722C85UI, &HA2BFE8A1UI, &HA81A664BUI,
        &HC24B8B70UI, &HC76C51A3UI, &HD192E819UI, &HD6990624UI, &HF40E3585UI, &H106AA070,
        &H19A4C116, &H1E376C08, &H2748774C, &H34B0BCB5, &H391C0CB3, &H4ED8AA4A,
        &H5B9CCA4F, &H682E6FF3, &H748F82EE, &H78A5636F, &H84C87814UI, &H8CC70208UI,
        &H90BEFFFAUI, &HA4506CEBUI, &HBEF9A3F7UI, &HC67178F2UI}
Private Shared Sub SHA256Transform(ByRef ctx As SHA256_CTX, data As Byte())
    Dim a As UInteger, b As UInteger, c As UInteger, d As UInteger, e As UInteger, f As UInteger,
            g As UInteger, h As UInteger, i As UInteger, j As UInteger, t1 As UInteger, t2 As UInteger
    Dim m As UInteger() = New UInteger(63) {}
    i = 0
    j = 0
    While i < 16
        m(i) = ((CULng(data(j)) << 24) Or (CULng(data(j + 1)) << 16) Or (CULng(data(j + 2)) << 8) Or (data(j + 3))) And UInteger.MaxValue
        i += 1
        j += 4
    End While
    While i < 64
        m(i) = CULng(SIG1(m(i - 2))) + m(i - 7) + SIG0(m(i - 15)) + m(i - 16) And UInteger.MaxValue
        i += 1
    End While
    a = ctx.state(0)
    b = ctx.state(1)
    c = ctx.state(2)
    d = ctx.state(3)
    e = ctx.state(4)
    f = ctx.state(5)
    g = ctx.state(6)
    h = ctx.state(7)
    For i = 0 To 63
        t1 = (CULng(h) + EP1(e) + CH(e, f, g) + k(i) + m(i)) And UInteger.MaxValue
        t2 = (CULng(EP0(a)) + MAJ(a, b, c)) And UInteger.MaxValue
        h = g
        g = f
        f = e
        e = (CULng(d) + t1) And UInteger.MaxValue
        d = c
        c = b
        b = a
        a = (CULng(t1) + t2) And UInteger.MaxValue
    Next
    ctx.state(0) = (CULng(ctx.state(0)) + a) And UInteger.MaxValue
    ctx.state(1) = (CULng(ctx.state(1)) + b) And UInteger.MaxValue
    ctx.state(2) = (CULng(ctx.state(2)) + c) And UInteger.MaxValue
    ctx.state(3) = (CULng(ctx.state(3)) + d) And UInteger.MaxValue
    ctx.state(4) = (CULng(ctx.state(4)) + e) And UInteger.MaxValue
    ctx.state(5) = (CULng(ctx.state(5)) + f) And UInteger.MaxValue
    ctx.state(6) = (CULng(ctx.state(6)) + g) And UInteger.MaxValue
    ctx.state(7) = (CULng(ctx.state(7)) + h) And UInteger.MaxValue
End Sub
Private Shared Sub SHA256Init(ByRef ctx As SHA256_CTX)
    ctx.datalen = 0
    ctx.bitlen(0) = 0
    ctx.bitlen(1) = 0
    ctx.state(0) = &H6A09E667
    ctx.state(1) = &HBB67AE85UI
    ctx.state(2) = &H3C6EF372
    ctx.state(3) = &HA54FF53AUI
    ctx.state(4) = &H510E527F
    ctx.state(5) = &H9B05688CUI
    ctx.state(6) = &H1F83D9AB
    ctx.state(7) = &H5BE0CD19
End Sub
Private Shared Sub SHA256Update(ByRef ctx As SHA256_CTX, data As Byte(), len As UInteger)
    For i As UInteger = 0 To len - 1
        ctx.data(ctx.datalen) = data(i)
        ctx.datalen += 1
        If ctx.datalen = 64 Then
            SHA256Transform(ctx, ctx.data)
            DBL_INT_ADD(ctx.bitlen(0), ctx.bitlen(1), 512)
            ctx.datalen = 0
        End If
    Next
End Sub
Private Shared Sub SHA256Final(ByRef ctx As SHA256_CTX, hash As Byte())
    Dim i As UInteger = ctx.datalen
    If ctx.datalen < 56 Then
        ctx.data(System.Math.Max(i, i - 1)) = &H80
        i += 1
        While i < 56
            ctx.data(System.Math.Max(i, i - 1)) = &H0
            i += 1
        End While
    Else
        ctx.data(System.Math.Max(i, i - 1)) = &H80
        i += 1
        While i < 64
            ctx.data(System.Math.Max(i, i - 1)) = &H0
            i += 1
        End While
        SHA256Transform(ctx, ctx.data)
    End If
    DBL_INT_ADD(ctx.bitlen(0), ctx.bitlen(1), ctx.datalen * 8)
    ctx.data(63) = CByte(ctx.bitlen(0))
    ctx.data(62) = CByte(ctx.bitlen(0) >> 8)
    ctx.data(61) = CByte(ctx.bitlen(0) >> 16)
    ctx.data(60) = CByte(ctx.bitlen(0) >> 24)
    ctx.data(59) = CByte(ctx.bitlen(1))
    ctx.data(58) = CByte(ctx.bitlen(1) >> 8)
    ctx.data(57) = CByte(ctx.bitlen(1) >> 16)
    ctx.data(56) = CByte(ctx.bitlen(1) >> 24)
    SHA256Transform(ctx, ctx.data)
    For i = 0 To 3
        hash(i) = CByte(((ctx.state(0)) >> CInt(24 - i * 8)) And &HFF)
        hash(i + 4) = CByte(((ctx.state(1)) >> CInt(24 - i * 8)) And &HFF)
        hash(i + 8) = CByte(((ctx.state(2)) >> CInt(24 - i * 8)) And &HFF)
        hash(i + 12) = CByte((ctx.state(3) >> CInt(24 - i * 8)) And &HFF)
        hash(i + 16) = CByte((ctx.state(4) >> CInt(24 - i * 8)) And &HFF)
        hash(i + 20) = CByte((ctx.state(5) >> CInt(24 - i * 8)) And &HFF)
        hash(i + 24) = CByte((ctx.state(6) >> CInt(24 - i * 8)) And &HFF)
        hash(i + 28) = CByte((ctx.state(7) >> CInt(24 - i * 8)) And &HFF)
    Next
End Sub
Public Shared Function SHA256(data As String) As String
    Dim ctx As New SHA256_CTX()
    ctx.data = New Byte(63) {}
    ctx.bitlen = New UInteger(1) {}
    ctx.state = New UInteger(7) {}
    Dim hash As Byte() = New Byte(31) {}
    Dim hashStr As String = String.Empty
    SHA256Init(ctx)
    SHA256Update(ctx, Encoding.[Default].GetBytes(data), CUInt(data.Length))
    SHA256Final(ctx, hash)
    For i As Integer = 0 To 31
        hashStr += String.Format("{0:X2}", hash(i))
    Next
    Return hashStr
End Function

Çözüm:
sonuç.Text = SHA256(veri.Text) 'key yok burada sadece 2 adet textbox kullanalım.
 
Son düzenleme:

Maveraün Nehr

Blue Expert / Head of Malware Team
25 Haz 2021
976
1,865
41.303921, -81.901693
Rijndael Şifreleme Modülü:

Kod:
 Public Shared Function Rijndaelcrypt(ByVal File As String, ByVal Key As String)
        Dim oAesProvider As New RijndaelManaged
        Dim btClear() As Byte
        Dim btSalt() As Byte = New Byte() {1, 2, 3, 4, 5, 6, 7, 8}
        Dim oKeyGenerator As New Rfc2898DeriveBytes(Key, btSalt)
        oAesProvider.Key = oKeyGenerator.GetBytes(oAesProvider.Key.Length)
        oAesProvider.IV = oKeyGenerator.GetBytes(oAesProvider.IV.Length)
        Dim ms As New IO.MemoryStream
        Dim cs As New CryptoStream(ms,
    oAesProvider.CreateEncryptor(),
    CryptoStreamMode.Write)
        btClear = System.Text.Encoding.UTF8.GetBytes(File)
        cs.Write(btClear, 0, btClear.Length)
        cs.Close()
        File = Convert.ToBase64String(ms.ToArray)
        Return File
    End Function

    Public Shared Function RijndaelDecrypt(ByVal UDecryptU As String, ByVal UKeyU As String)
        Dim XoAesProviderX As New RijndaelManaged
        Dim XbtCipherX() As Byte
        Dim XbtSaltX() As Byte = New Byte() {1, 2, 3, 4, 5, 6, 7, 8}
        Dim XoKeyGeneratorX As New Rfc2898DeriveBytes(UKeyU, XbtSaltX)
        XoAesProviderX.Key = XoKeyGeneratorX.GetBytes(XoAesProviderX.Key.Length)
        XoAesProviderX.IV = XoKeyGeneratorX.GetBytes(XoAesProviderX.IV.Length)
        Dim XmsX As New IO.MemoryStream
        Dim XcsX As New CryptoStream(XmsX, XoAesProviderX.CreateDecryptor(),
    CryptoStreamMode.Write)
        Try
            XbtCipherX = Convert.FromBase64String(UDecryptU)
            XcsX.Write(XbtCipherX, 0, XbtCipherX.Length)
            XcsX.Close()
            UDecryptU = System.Text.Encoding.UTF8.GetString(XmsX.ToArray)
        Catch
        End Try
        Return UDecryptU
    End Function

Çözüm:
sonuç.Text = RijndaelEncrypt(veri.Text, key.Text) 'şifreler :)
sonuç.Text = RijndaelDecrypt(veri.Text, key.Text) 'Çözer



Ellerine Sağlık
Teşekkürler hoşgeldiniz konuma. :) Devam edeceğiz konuya daha bilgi çok.
 

'The Wolf

Kıdemli Üye
22 Nis 2021
4,043
2,565
Tanrı dağı
Source undetected için bazı şifreleme modülleri aşağıdadır. Kodlar şahsıma ait değildir.

Foruma 3 adet textbox ve bir adet buton ekleyelim. Tüm şifreleme sistemleri için geçerlidir.
Textbox'larımızın isimlerini veri, key, sonuç olarak değiştirelim. Cryptography kütüphanemizi Import etmeyi unutmayalım. :)

Sezar Şifreleme Modülü:

Kod:
Private Shared Function Cipher(ch As Char, key As Integer) As Char
    If Not Char.IsLetter(ch) Then
        Return ch
    End If
    Dim offset As Integer = Convert.ToInt32(If(Char.IsUpper(ch), "A"c, "a"c))
    Return ChrW((((Convert.ToInt32(ch) + key) - offset) Mod 26) + offset)
End Function
Public Shared Function Encipher(input As String, key As Integer) As String
    Dim output As String = String.Empty
    For Each ch As Char In input
        output += Cipher(ch, key)
    Next
    Return output
End Function
Public Shared Function Decipher(input As String, key As Integer) As String
    Return Encipher(input, 26 - key)
End Function

Çözüm:

sonuç.Text = Encipher(veri.Text, key.Text) 'key kısmına 0'dan 9'a kadar sayı yazabiliriz harf girerse hata veriyor. Bu arada burası şifreler :)
sonuç.Text = Decipher(veri.Text, key.Text) 'Çözer

AES Şifreleme Modülü:

Kod:
 Public Function AES_Encrypt(ByVal input As String, ByVal pass As String) As String
        Dim AES As New System.Security.Cryptography.RijndaelManaged
        Dim Hash_AES As New System.Security.Cryptography.MD5CryptoServiceProvider
        Dim encrypted As String = ""
        Try
            Dim hash(31) As Byte
            Dim temp As Byte() = Hash_AES.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(pass))
            Array.Copy(temp, 0, hash, 0, 16)
            Array.Copy(temp, 0, hash, 15, 16)
            AES.Key = hash
            AES.Mode = Security.Cryptography.CipherMode.ECB
            Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = AES.CreateEncryptor
            Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(input)
            encrypted = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
            Return encrypted
        Catch ex As Exception
        End Try
    End Function
    Public Function AES_Decrypt(ByVal input As String, ByVal pass As String) As String
        Dim AES As New System.Security.Cryptography.RijndaelManaged
        Dim Hash_AES As New System.Security.Cryptography.MD5CryptoServiceProvider
        Dim decrypted As String = ""
        Try
            Dim hash(31) As Byte
            Dim temp As Byte() = Hash_AES.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(pass))
            Array.Copy(temp, 0, hash, 0, 16)
            Array.Copy(temp, 0, hash, 15, 16)
            AES.Key = hash
            AES.Mode = Security.Cryptography.CipherMode.ECB
            Dim DESDecrypter As System.Security.Cryptography.ICryptoTransform = AES.CreateDecryptor
            Dim Buffer As Byte() = Convert.FromBase64String(input)
            decrypted = System.Text.ASCIIEncoding.ASCII.GetString(DESDecrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
            Return decrypted
        Catch ex As Exception
        End Try
    End Function

Çözüm:

sonuç.Text = AES_Encrypt(veri.Text, key.Text) 'Şifreler
sonuç.Text =AES_Decrypt(veri.Text, key.Text) 'Çözer

RC4 Şifreleme Modülü:

Kod:
 Public Shared Function rc4(ByVal message As String, ByVal password As String) As String
        Dim i As Integer = 0
        Dim j As Integer = 0
        Dim cipher As New StringBuilder
        Dim returnCipher As String = String.Empty
        Dim sbox As Integer() = New Integer(256) {}
        Dim key As Integer() = New Integer(256) {}
        Dim intLength As Integer = password.Length
        Dim a As Integer = 0
        While a <= 255
            Dim ctmp As Char = (password.Substring((a Mod intLength), 1).ToCharArray()(0))
            key(a) = Microsoft.VisualBasic.Strings.Asc(ctmp)
            sbox(a) = a
            System.Math.Max(System.Threading.Interlocked.Increment(a), a - 1)
        End While
        Dim x As Integer = 0
        Dim b As Integer = 0
        While b <= 255
            x = (x + sbox(b) + key(b)) Mod 256
            Dim tempSwap As Integer = sbox(b)
            sbox(b) = sbox(x)
            sbox(x) = tempSwap
            System.Math.Max(System.Threading.Interlocked.Increment(b), b - 1)
        End While
        a = 1
        While a <= message.Length
            Dim itmp As Integer = 0
            i = (i + 1) Mod 256
            j = (j + sbox(i)) Mod 256
            itmp = sbox(i)
            sbox(i) = sbox(j)
            sbox(j) = itmp
            Dim k As Integer = sbox((sbox(i) + sbox(j)) Mod 256)
            Dim ctmp As Char = message.Substring(a - 1, 1).ToCharArray()(0)
            itmp = Asc(ctmp)
            Dim cipherby As Integer = itmp Xor k
            cipher.Append(Chr(cipherby))
            System.Math.Max(System.Threading.Interlocked.Increment(a), a - 1)
        End While
        returnCipher = cipher.ToString
        cipher.Length = 0
        Return returnCipher
    End Function

Çözüm:
sonuç.Text = rc4(veri.Text, key.Text)


x0r Şifreleme Modülü:

Kod:
Public Shared Function XORCipher(data As String, key As String) As String
        Dim dataLen As Integer = data.Length
        Dim keyLen As Integer = key.Length
        Dim output As Char() = New Char(dataLen - 1) {}
        For i As Integer = 0 To dataLen - 1
            output(i) = ChrW(Asc(data(i)) Xor Asc(key(i Mod keyLen)))
        Next
        Return New String(output)
    End Function

Çözüm:
sonuç.Text = XORCipher(veri.Text, key.Text)


Playfair Şifreleme Modülü:

Kod:
Private Shared Function [Mod](a As Integer, b As Integer) As Integer
    Return (a Mod b + b) Mod b
End Function
Private Shared Function FindAllOccurrences(str As String, value As Char) As List(Of Integer)
    Dim indexes As New List(Of Integer)()
    Dim index As Integer = 0
    While index <> -1
        index = str.IndexOf(value, index)
        If index <> -1 Then
            indexes.Add(index)
            index += 1
        End If
    End While
    Return indexes
End Function
Private Shared Function RemoveAllDuplicates(str As String, indexes As List(Of Integer)) As String
    Dim retVal As String = str
    For i As Integer = indexes.Count - 1 To 1 Step -1
        retVal = retVal.Remove(indexes(i), 1)
    Next
    Return retVal
End Function
Private Shared Function GenerateKeySquare(key As String) As Char(,)
    Dim keySquare As Char(,) = New Char(4, 4) {}
    Dim defaultKeySquare As String = "ABCDEFGHIKLMNOPQRSTUVWXYZ"
    Dim tempKey As String = If(String.IsNullOrEmpty(key), "CIPHER", key.ToUpper())
    tempKey = tempKey.Replace("J", "")
    tempKey += defaultKeySquare
    For i As Integer = 0 To 24
        Dim indexes As List(Of Integer) = FindAllOccurrences(tempKey, defaultKeySquare(i))
        tempKey = RemoveAllDuplicates(tempKey, indexes)
    Next
    tempKey = tempKey.Substring(0, 25)
    For i As Integer = 0 To 24
        keySquare((i \ 5), (i Mod 5)) = tempKey(i)
    Next
    Return keySquare
End Function
Private Shared Sub GetPosition(ByRef keySquare As Char(,), ch As Char, ByRef row As Integer, ByRef col As Integer)
    If ch = "J"c Then
        GetPosition(keySquare, "I"c, row, col)
    End If
    For i As Integer = 0 To 4
        For j As Integer = 0 To 4
            If keySquare(i, j) = ch Then
                row = i
                col = j
            End If
        Next
    Next
End Sub
Private Shared Function SameRow(ByRef keySquare As Char(,), row As Integer, col1 As Integer, col2 As Integer, encipher As Integer) As Char()
    Return New Char() {keySquare(row, [Mod]((col1 + encipher), 5)), keySquare(row, [Mod]((col2 + encipher), 5))}
End Function
Private Shared Function SameColumn(ByRef keySquare As Char(,), col As Integer, row1 As Integer, row2 As Integer, encipher As Integer) As Char()
    Return New Char() {keySquare([Mod]((row1 + encipher), 5), col), keySquare([Mod]((row2 + encipher), 5), col)}
End Function
Private Shared Function SameRowColumn(ByRef keySquare As Char(,), row As Integer, col As Integer, encipher As Integer) As Char()
    Return New Char() {keySquare([Mod]((row + encipher), 5), [Mod]((col + encipher), 5)), keySquare([Mod]((row + encipher), 5), [Mod]((col + encipher), 5))}
End Function
Private Shared Function DifferentRowColumn(ByRef keySquare As Char(,), row1 As Integer, col1 As Integer, row2 As Integer, col2 As Integer) As Char()
    Return New Char() {keySquare(row1, col2), keySquare(row2, col1)}
End Function
Private Shared Function RemoveOtherChars(input As String) As String
    Dim output As String = input
    Dim i As Integer = 0
    While i < output.Length
        If Not Char.IsLetter(output(i)) Then
            output = output.Remove(i, 1)
        End If
        i += 1
    End While
    Return output
End Function
Private Shared Function AdjustOutput(input As String, output As String) As String
    Dim retVal As New StringBuilder(output)
    For i As Integer = 0 To input.Length - 1
        If Not Char.IsLetter(input(i)) Then
            retVal = retVal.Insert(i, input(i).ToString())
        End If
        If Char.IsLower(input(i)) Then
            retVal(i) = Char.ToLower(retVal(i))
        End If
    Next
    Return retVal.ToString()
End Function

Private Shared Function Cipher(input As String, key As String, encipher As Boolean) As String
    Dim retVal As String = String.Empty
    Dim keySquare As Char(,) = GenerateKeySquare(key)
    Dim tempInput As String = RemoveOtherChars(input)
    Dim e As Integer = If(encipher, 1, -1)
    If (tempInput.Length Mod 2) <> 0 Then
        tempInput += "X"
    End If
    For i As Integer = 0 To tempInput.Length - 1 Step 2
        Dim row1 As Integer = 0
        Dim col1 As Integer = 0
        Dim row2 As Integer = 0
        Dim col2 As Integer = 0
        GetPosition(keySquare, Char.ToUpper(tempInput(i)), row1, col1)
        GetPosition(keySquare, Char.ToUpper(tempInput(i + 1)), row2, col2)
        If row1 = row2 AndAlso col1 = col2 Then
            retVal += New String(SameRowColumn(keySquare, row1, col1, e))
        ElseIf row1 = row2 Then
            retVal += New String(SameRow(keySquare, row1, col1, col2, e))
        ElseIf col1 = col2 Then
            retVal += New String(SameColumn(keySquare, col1, row1, row2, e))
        Else
            retVal += New String(DifferentRowColumn(keySquare, row1, col1, row2, col2))
        End If
    Next
    retVal = AdjustOutput(input, retVal)
    Return retVal
End Function
Public Shared Function Encipher(input As String, key As String) As String
    Return Cipher(input, key, True)
End Function
Public Shared Function Decipher(input As String, key As String) As String
    Return Cipher(input, key, False)
End Function

Çözüm:

sonuç.Text = Encipher(veri.Text, key.Text) 'şifreler :)
sonuç.Text = Decipher(veri.Text, key.Text) 'Çözer

Vigenere Şifreleme Modülü:

Kod:
Private Shared Function [Mod](a As Integer, b As Integer) As Integer
    Return (a Mod b + b) Mod b
End Function
Private Shared Function Cipher(input As String, key As String, encipher As Boolean) As String
    For i As Integer = 0 To key.Length - 1
        If Not Char.IsLetter(key(i)) Then
            Return Nothing ' Error
        End If
    Next
    Dim output As String = String.Empty
    Dim nonAlphaCharCount As Integer = 0
    For i As Integer = 0 To input.Length - 1
        If Char.IsLetter(input(i)) Then
            Dim cIsUpper As Boolean = Char.IsUpper(input(i))
            Dim offset As Integer = Convert.ToInt32(If(cIsUpper, "A"c, "a"c))
            Dim keyIndex As Integer = (i - nonAlphaCharCount) Mod key.Length
            Dim k As Integer = Convert.ToInt32(If(cIsUpper, Char.ToUpper(key(keyIndex)), Char.ToLower(key(keyIndex)))) - offset
            k = If(encipher, k, -k)
            Dim ch As Char = ChrW(([Mod](((Convert.ToInt32(input(i)) + k) - offset), 26)) + offset)
            output += ch
        Else
            output += input(i)
            nonAlphaCharCount += 1
        End If
    Next
    Return output
End Function
Public Shared Function Encipher(input As String, key As String) As String
    Return Cipher(input, key, True)
End Function
Public Shared Function Decipher(input As String, key As String) As String
    Return Cipher(input, key, False)
End Function

Çözüm:

sonuç.Text = Encipher(veri.Text, key.Text) 'şifreler :)
sonuç.Text = Decipher(veri.Text, key.Text) 'Çözer

SHA256 Şifreleme Modülü:

Kod:
Private Shared Sub DBL_INT_ADD(ByRef a As UInteger, ByRef b As UInteger, c As UInteger)
    If a > &HFFFFFFFFUI - c Then
        b += 1
    End If
    a += c
End Sub
Private Shared Function ROTLEFT(a As UInteger, b As Byte) As UInteger
    Return ((a << b) Or (a >> (32 - b)))
End Function
Private Shared Function ROTRIGHT(a As UInteger, b As Byte) As UInteger
    Return (((a) >> (b)) Or ((a) << (32 - (b))))
End Function
Private Shared Function CH(x As UInteger, y As UInteger, z As UInteger) As UInteger
    Return (((x) And (y)) Xor (Not (x) And (z)))
End Function
Private Shared Function MAJ(x As UInteger, y As UInteger, z As UInteger) As UInteger
    Return (((x) And (y)) Xor ((x) And (z)) Xor ((y) And (z)))
End Function
Private Shared Function EP0(x As UInteger) As UInteger
    Return (ROTRIGHT(x, 2) Xor ROTRIGHT(x, 13) Xor ROTRIGHT(x, 22))
End Function
Private Shared Function EP1(x As UInteger) As UInteger
    Return (ROTRIGHT(x, 6) Xor ROTRIGHT(x, 11) Xor ROTRIGHT(x, 25))
End Function
Private Shared Function SIG0(x As UInteger) As UInteger
    Return (ROTRIGHT(x, 7) Xor ROTRIGHT(x, 18) Xor ((x) >> 3))
End Function
Private Shared Function SIG1(x As UInteger) As UInteger
    Return (ROTRIGHT(x, 17) Xor ROTRIGHT(x, 19) Xor ((x) >> 10))
End Function
Private Structure SHA256_CTX
    Public data As Byte()
    Public datalen As UInteger
    Public bitlen As UInteger()
    Public state As UInteger()
End Structure
Shared k As UInteger() = {&H428A2F98, &H71374491, &HB5C0FBCFUI, &HE9B5DBA5UI, &H3956C25B, &H59F111F1,
        &H923F82A4UI, &HAB1C5ED5UI, &HD807AA98UI, &H12835B01, &H243185BE, &H550C7DC3,
        &H72BE5D74, &H80DEB1FEUI, &H9BDC06A7UI, &HC19BF174UI, &HE49B69C1UI, &HEFBE4786UI,
        &HFC19DC6, &H240CA1CC, &H2DE92C6F, &H4A7484AA, &H5CB0A9DC, &H76F988DA,
        &H983E5152UI, &HA831C66DUI, &HB00327C8UI, &HBF597FC7UI, &HC6E00BF3UI, &HD5A79147UI,
        &H6CA6351, &H14292967, &H27B70A85, &H2E1B2138, &H4D2C6DFC, &H53380D13,
        &H650A7354, &H766A0ABB, &H81C2C92EUI, &H92722C85UI, &HA2BFE8A1UI, &HA81A664BUI,
        &HC24B8B70UI, &HC76C51A3UI, &HD192E819UI, &HD6990624UI, &HF40E3585UI, &H106AA070,
        &H19A4C116, &H1E376C08, &H2748774C, &H34B0BCB5, &H391C0CB3, &H4ED8AA4A,
        &H5B9CCA4F, &H682E6FF3, &H748F82EE, &H78A5636F, &H84C87814UI, &H8CC70208UI,
        &H90BEFFFAUI, &HA4506CEBUI, &HBEF9A3F7UI, &HC67178F2UI}
Private Shared Sub SHA256Transform(ByRef ctx As SHA256_CTX, data As Byte())
    Dim a As UInteger, b As UInteger, c As UInteger, d As UInteger, e As UInteger, f As UInteger,
            g As UInteger, h As UInteger, i As UInteger, j As UInteger, t1 As UInteger, t2 As UInteger
    Dim m As UInteger() = New UInteger(63) {}
    i = 0
    j = 0
    While i < 16
        m(i) = ((CULng(data(j)) << 24) Or (CULng(data(j + 1)) << 16) Or (CULng(data(j + 2)) << 8) Or (data(j + 3))) And UInteger.MaxValue
        i += 1
        j += 4
    End While
    While i < 64
        m(i) = CULng(SIG1(m(i - 2))) + m(i - 7) + SIG0(m(i - 15)) + m(i - 16) And UInteger.MaxValue
        i += 1
    End While
    a = ctx.state(0)
    b = ctx.state(1)
    c = ctx.state(2)
    d = ctx.state(3)
    e = ctx.state(4)
    f = ctx.state(5)
    g = ctx.state(6)
    h = ctx.state(7)
    For i = 0 To 63
        t1 = (CULng(h) + EP1(e) + CH(e, f, g) + k(i) + m(i)) And UInteger.MaxValue
        t2 = (CULng(EP0(a)) + MAJ(a, b, c)) And UInteger.MaxValue
        h = g
        g = f
        f = e
        e = (CULng(d) + t1) And UInteger.MaxValue
        d = c
        c = b
        b = a
        a = (CULng(t1) + t2) And UInteger.MaxValue
    Next
    ctx.state(0) = (CULng(ctx.state(0)) + a) And UInteger.MaxValue
    ctx.state(1) = (CULng(ctx.state(1)) + b) And UInteger.MaxValue
    ctx.state(2) = (CULng(ctx.state(2)) + c) And UInteger.MaxValue
    ctx.state(3) = (CULng(ctx.state(3)) + d) And UInteger.MaxValue
    ctx.state(4) = (CULng(ctx.state(4)) + e) And UInteger.MaxValue
    ctx.state(5) = (CULng(ctx.state(5)) + f) And UInteger.MaxValue
    ctx.state(6) = (CULng(ctx.state(6)) + g) And UInteger.MaxValue
    ctx.state(7) = (CULng(ctx.state(7)) + h) And UInteger.MaxValue
End Sub
Private Shared Sub SHA256Init(ByRef ctx As SHA256_CTX)
    ctx.datalen = 0
    ctx.bitlen(0) = 0
    ctx.bitlen(1) = 0
    ctx.state(0) = &H6A09E667
    ctx.state(1) = &HBB67AE85UI
    ctx.state(2) = &H3C6EF372
    ctx.state(3) = &HA54FF53AUI
    ctx.state(4) = &H510E527F
    ctx.state(5) = &H9B05688CUI
    ctx.state(6) = &H1F83D9AB
    ctx.state(7) = &H5BE0CD19
End Sub
Private Shared Sub SHA256Update(ByRef ctx As SHA256_CTX, data As Byte(), len As UInteger)
    For i As UInteger = 0 To len - 1
        ctx.data(ctx.datalen) = data(i)
        ctx.datalen += 1
        If ctx.datalen = 64 Then
            SHA256Transform(ctx, ctx.data)
            DBL_INT_ADD(ctx.bitlen(0), ctx.bitlen(1), 512)
            ctx.datalen = 0
        End If
    Next
End Sub
Private Shared Sub SHA256Final(ByRef ctx As SHA256_CTX, hash As Byte())
    Dim i As UInteger = ctx.datalen
    If ctx.datalen < 56 Then
        ctx.data(System.Math.Max(i, i - 1)) = &H80
        i += 1
        While i < 56
            ctx.data(System.Math.Max(i, i - 1)) = &H0
            i += 1
        End While
    Else
        ctx.data(System.Math.Max(i, i - 1)) = &H80
        i += 1
        While i < 64
            ctx.data(System.Math.Max(i, i - 1)) = &H0
            i += 1
        End While
        SHA256Transform(ctx, ctx.data)
    End If
    DBL_INT_ADD(ctx.bitlen(0), ctx.bitlen(1), ctx.datalen * 8)
    ctx.data(63) = CByte(ctx.bitlen(0))
    ctx.data(62) = CByte(ctx.bitlen(0) >> 8)
    ctx.data(61) = CByte(ctx.bitlen(0) >> 16)
    ctx.data(60) = CByte(ctx.bitlen(0) >> 24)
    ctx.data(59) = CByte(ctx.bitlen(1))
    ctx.data(58) = CByte(ctx.bitlen(1) >> 8)
    ctx.data(57) = CByte(ctx.bitlen(1) >> 16)
    ctx.data(56) = CByte(ctx.bitlen(1) >> 24)
    SHA256Transform(ctx, ctx.data)
    For i = 0 To 3
        hash(i) = CByte(((ctx.state(0)) >> CInt(24 - i * 8)) And &HFF)
        hash(i + 4) = CByte(((ctx.state(1)) >> CInt(24 - i * 8)) And &HFF)
        hash(i + 8) = CByte(((ctx.state(2)) >> CInt(24 - i * 8)) And &HFF)
        hash(i + 12) = CByte((ctx.state(3) >> CInt(24 - i * 8)) And &HFF)
        hash(i + 16) = CByte((ctx.state(4) >> CInt(24 - i * 8)) And &HFF)
        hash(i + 20) = CByte((ctx.state(5) >> CInt(24 - i * 8)) And &HFF)
        hash(i + 24) = CByte((ctx.state(6) >> CInt(24 - i * 8)) And &HFF)
        hash(i + 28) = CByte((ctx.state(7) >> CInt(24 - i * 8)) And &HFF)
    Next
End Sub
Public Shared Function SHA256(data As String) As String
    Dim ctx As New SHA256_CTX()
    ctx.data = New Byte(63) {}
    ctx.bitlen = New UInteger(1) {}
    ctx.state = New UInteger(7) {}
    Dim hash As Byte() = New Byte(31) {}
    Dim hashStr As String = String.Empty
    SHA256Init(ctx)
    SHA256Update(ctx, Encoding.[Default].GetBytes(data), CUInt(data.Length))
    SHA256Final(ctx, hash)
    For i As Integer = 0 To 31
        hashStr += String.Format("{0:X2}", hash(i))
    Next
    Return hashStr
End Function

Çözüm:
sonuç.Text = SHA256(veri.Text) 'key yok burada sadece 2 adet textbox kullanalım.
Eline sağlık.
 

Maveraün Nehr

Blue Expert / Head of Malware Team
25 Haz 2021
976
1,865
41.303921, -81.901693
Emeğinize sağlık hocam.
Siz de hoşgeldiniz

Stairs Şifreleme Modülü:

Kod:
    Public Shared Function Crypt(ByVal Data As String, ByVal key As String) As String
        Return Encoding.Default.GetString(Crypt(Encoding.Default.GetBytes(Data), Encoding.Default.GetBytes(key)))
    End Function
    Public Shared Function Crypt(ByVal Data() As Byte, ByVal key() As Byte) As Byte()
        For i = 0 To (Data.Length * 2) + key.Length
            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)
        Next
        Return Data
    End Function
    Public Shared Function DeCrypt(ByVal Data As String, ByVal key As String) As String
        Return Encoding.Default.GetString(DeCrypt(Encoding.Default.GetBytes(Data), Encoding.Default.GetBytes(key)))
    End Function
    Public Shared Function DeCrypt(ByVal Data() As Byte, ByVal key() As Byte) As Byte()
        For i = (Data.Length * 2) + key.Length To 0 Step -1
            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)
        Next
        Return Data
    End Function

Çözüm:
sonuç.Text = Encrypt(veri.Text, key.Text) 'şifreler :)
sonuç.Text = Decrypt(veri.Text, key.Text) 'Çözer
 
Moderatör tarafında düzenlendi:
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.