Avatar billede Martin Praktikant
28. januar 2021 - 01:56

Encrypt der passer til min Decrypt

Hej

Jeg har et program jeg har lave for en del år tilbage og ikke kan finde min KeyGenrator er jeg ved at lave den og da jeg ikke kan huske hvordan jeg lave min modEncrypt håber jeg en kan hjælpe mig .



<StandardModule()> _
Friend NotInheritable Class modDecrypt

    ' Fields
    Private Const OFFSET_4 As Double = 4294967296
    Private Const MAXINT_4 As Double = 2147483647
    Private Const MININT_4 As Double = -2147483648
    Private Const OFFSET_2 As Integer = &H10000
    Private Const MAXINT_2 As Short = &H7FFF
    Private Const ROTORSZ As Short = &H100
    Private Const MASK As Short = &HFF
    Private Const EncryptionKey As Integer = &H5B433EF

    Private Shared Function And64(ByRef x As Double, ByRef y As Double) As Double
        Dim num4 As Integer = CInt(Math.Round(Conversion.Fix(CDbl((x / 2147483648)))))
        Dim num5 As Integer = CInt(Math.Round(CDbl((x - (2147483648 * num4)))))
        Dim num6 As Integer = CInt(Math.Round(Conversion.Fix(CDbl((y / 2147483648)))))
        Dim num7 As Integer = CInt(Math.Round(CDbl((y - (2147483648 * num6)))))
        Dim num2 As Integer = (num4 And num6)
        Dim num3 As Integer = (num5 And num7)
        Return ((2147483648 * num2) + num3)
    End Function

    Public Shared Function Decrypt(ByVal HashedValue As String, ByRef RAWValue As String) As Integer
        Dim key As Integer = &H5B433EF
        Return modDecrypt.sp_Decrypt(RAWValue, HashedValue, key)
    End Function

    Private Shared Function GetChecksum(ByRef RAW As String) As Integer
        Dim num As Integer = 0
        Dim num4 As Integer = Strings.Len(CStr(RAW))
        Dim i As Integer = 1
        Do While (i <= num4)
            If ((num + Strings.Asc(Strings.Mid(RAW, i, 1))) > &H80) Then
                num = ((num + Strings.Asc(Strings.Mid(RAW, i, 1))) - &H100)
            Else
                num = (num + Strings.Asc(Strings.Mid(RAW, i, 1)))
            End If
            i += 1
        Loop
        If (num > &H80) Then
            Do While (num < &H100)
                num = (num + &H1F)
            Loop
            num = (num - &H100)
        End If
        Do While (num < 0)
            num = (num + &H1F)
        Loop
        Return num
    End Function

    Private Shared Function GetSeed(ByRef Key As Integer) As Integer
        Dim str As String = "RUGNCM#$AODS"
        Dim vIn As Double = (Key + &H7B)
        Dim start As Short = 1
        Do
            vIn = (modDecrypt.RollNumber(vIn, Strings.Asc(Strings.Mid(str, start, 1))) + (start - 1))
            start = CShort((start + 1))
        Loop While (start <= 12)
        Return CInt(Math.Round(vIn))
    End Function

    Private Shared Function RollNumber(ByRef vIn As Double, ByRef vTimes As Integer) As Double
        Dim num As Double = 2147483647
        Dim num2 As Double = vIn
        Dim num5 As Integer = (vTimes - 1)
        Dim i As Integer = 1
        Do While (i <= num5)
            num2 = (num2 + vIn)
            If (num2 > num) Then
                num2 = (num2 - 4294967296)
            End If
            If (num2 < -2147483648) Then
                num2 = (num2 + 4294967296)
            End If
            i += 1
        Loop
        Return num2
    End Function

    Public Shared Function sp_Decrypt(ByRef RAW As String, ByRef ENC As String, ByRef Key As Integer) As Integer
        Dim num10 As Integer
        Dim num16 As Integer
        Try
            Dim num6 As Integer
            Dim num17 As Integer
Label_0000:
            ProjectData.ClearProjectError()
            Dim num15 As Integer = 2
Label_0008:
            num17 = 2
            Dim strArray2 As String() = New String(&H101 - 1) {}
Label_0017:
            num17 = 3
            Dim strArray As String() = New String(13 - 1) {}
Label_0022:
            num17 = 4
            strArray(0) = "R"
Label_002D:
            num17 = 5
            strArray(1) = "U"
Label_0038:
            num17 = 6
            strArray(2) = "G"
Label_0043:
            num17 = 7
            strArray(3) = "N"
Label_004E:
            num17 = 8
            strArray(4) = "C"
Label_0059:
            num17 = 9
            strArray(5) = "M"
Label_0065:
            num17 = 10
            strArray(6) = "#"
Label_0071:
            num17 = 11
            strArray(7) = "$"
Label_007D:
            num17 = 12
            strArray(8) = "A"
Label_0089:
            num17 = 13
            strArray(9) = "O"
Label_0096:
            num17 = 14
            strArray(10) = "D"
Label_00A3:
            num17 = 15
            strArray(11) = "S"
Label_00B0:
            num17 = &H10
            strArray(12) = ChrW(0)
Label_00BD:
            num17 = &H11
            Dim seed As Double = modDecrypt.GetSeed(Key)
Label_00CA:
            num17 = &H12
            Dim index As Integer = 0
Label_00D0:
            num17 = &H13
            If (index <= &H7F) Then
                GoTo Label_00EF
            End If
Label_00D9:
            num17 = 20
            strArray2(index) = Conversions.ToString(CInt((index - &H80)))
            GoTo Label_0101
Label_00EF:
            num17 = &H16
Label_00F3:
            num17 = &H17
            strArray2(index) = Conversions.ToString(index)
Label_0101:
            num17 = &H19
            index += 1
            If (index <= &HFF) Then
                GoTo Label_00D0
            End If
Label_0111:
            num17 = &H1A
            index = 0
Label_0117:
            num17 = &H1B
            Dim vTimes As Integer = 5
            seed = (modDecrypt.RollNumber(seed, vTimes) + Strings.Asc(strArray((index Mod 13))))
Label_0136:
            num17 = &H1C
            Dim x As Double = (4294967296 + (seed Mod 65521))
Label_0152:
            num17 = &H1D
            Dim a As Double = (&HFF - index)
Label_0160:
            num17 = 30
            Dim y As Double = 255
            Dim num4 As Double = (modDecrypt.And64(x, y) Mod (a + 1))
Label_0187:
            num17 = &H1F
            Dim num11 As Double = Conversions.ToDouble(strArray2(CInt(Math.Round(a))))
Label_019D:
            num17 = &H20
            strArray2(CInt(Math.Round(a))) = strArray2(CInt(Math.Round(num4)))
Label_01B7:
            num17 = &H21
            strArray2(CInt(Math.Round(num4))) = Conversions.ToString(num11)
Label_01CD:
            num17 = &H22
            index += 1
            If (index <= &HFF) Then
                GoTo Label_0117
            End If
Label_01E0:
            num17 = &H23
            Dim num As Short = CShort(Conversions.ToInteger(("&H" & Strings.Left(ENC, 2))))
Label_01FD:
            num17 = &H24
            Dim str As String = ""
Label_0208:
            num17 = &H25
            Dim num14 As Integer = CInt(Math.Round(CDbl(((CDbl(Strings.Len(CStr(ENC))) / 2) - 1))))
            index = 1
            GoTo Label_0290
Label_0234:
            num17 = &H26
            Dim num7 As Integer = Conversions.ToInteger(("&H" & Strings.Mid(ENC, ((index * 2) + 1), 2)))
Label_0256:
            num17 = &H27
            str = (str & Conversions.ToString(Strings.Chr((num7 Xor CInt(Conversions.ToLong(strArray2((num + num6))))))))
Label_027E:
            num17 = 40
            num6 += 1
Label_0288:
            num17 = &H29
            index += 1
Label_0290:
            If (index <= num14) Then
                GoTo Label_0234
            End If
Label_0295:
            num17 = &H2A
            RAW = str
Label_029D:
            num17 = &H2B
            num10 = 1
            GoTo Label_03D5
Label_02A9:
            ProjectData.ClearProjectError()
            num15 = 1
Label_02B1:
            num17 = &H2E
            num10 = 0
            GoTo Label_03D5
Label_02C1:
            num16 = 0
            Select Case (num16 + 1)
                Case 1
                    GoTo Label_0000
                Case 2
                    GoTo Label_0008
                Case 3
                    GoTo Label_0017
                Case 4
                    GoTo Label_0022
                Case 5
                    GoTo Label_002D
                Case 6
                    GoTo Label_0038
                Case 7
                    GoTo Label_0043
                Case 8
                    GoTo Label_004E
                Case 9
                    GoTo Label_0059
                Case 10
                    GoTo Label_0065
                Case 11
                    GoTo Label_0071
                Case 12
                    GoTo Label_007D
                Case 13
                    GoTo Label_0089
                Case 14
                    GoTo Label_0096
                Case 15
                    GoTo Label_00A3
                Case &H10
                    GoTo Label_00B0
                Case &H11
                    GoTo Label_00BD
                Case &H12
                    GoTo Label_00CA
                Case &H13
                    GoTo Label_00D0
                Case 20
                    GoTo Label_00D9
                Case &H15, &H18, &H19
                    GoTo Label_0101
                Case &H16
                    GoTo Label_00EF
                Case &H17
                    GoTo Label_00F3
                Case &H1A
                    GoTo Label_0111
                Case &H1B
                    GoTo Label_0117
                Case &H1C
                    GoTo Label_0136
                Case &H1D
                    GoTo Label_0152
                Case 30
                    GoTo Label_0160
                Case &H1F
                    GoTo Label_0187
                Case &H20
                    GoTo Label_019D
                Case &H21
                    GoTo Label_01B7
                Case &H22
                    GoTo Label_01CD
                Case &H23
                    GoTo Label_01E0
                Case &H24
                    GoTo Label_01FD
                Case &H25
                    GoTo Label_0208
                Case &H26
                    GoTo Label_0234
                Case &H27
                    GoTo Label_0256
                Case 40
                    GoTo Label_027E
                Case &H29
                    GoTo Label_0288
                Case &H2A
                    GoTo Label_0295
                Case &H2B
                    GoTo Label_029D
                Case &H2C, &H2F
                    GoTo Label_03D5
                Case &H2D
                    GoTo Label_02A9
                Case &H2E
                    GoTo Label_02B1
                Case Else
                    GoTo Label_03CA
            End Select
Label_038F:
            num16 = num17
            Select Case num15
                Case 0
                    GoTo Label_03CA
                Case 1
                    GoTo Label_02C1
                Case 2
                    GoTo Label_02A9
            End Select
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            GoTo Label_038F
        End Try
Label_03CA:
        Throw ProjectData.CreateProjectError(-2146828237)
Label_03D5:
        If (num16 <> 0) Then
            ProjectData.ClearProjectError()
        End If
        Return num10
    End Function

    Private Shared Function XOr64(ByRef x As Double, ByRef y As Double) As Double
        Dim num3 As Integer = CInt(Math.Round(Conversion.Fix(CDbl((x / 2147483648)))))
        Dim num4 As Integer = CInt(Math.Round(CDbl((x - (2147483648 * num3)))))
        Dim num6 As Integer = CInt(Math.Round(Conversion.Fix(CDbl((y / 2147483648)))))
        Dim num7 As Integer = CInt(Math.Round(CDbl((y - (2147483648 * num6)))))
        Dim num As Integer = (num3 Xor num6)
        Dim num2 As Integer = (num4 Xor num7)
        Return ((2147483648 * num) + num2)
    End Function
End Class
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester