Skip to content

Instantly share code, notes, and snippets.

@juananpe
Created July 25, 2022 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juananpe/62cf48c91950a5dbb5a6b6a7464a7380 to your computer and use it in GitHub Desktop.
Save juananpe/62cf48c91950a5dbb5a6b6a7464a7380 to your computer and use it in GitHub Desktop.
HackIt / Level 1 / backwards.vbs
REM ***** BASIC *****
Sub Main
Dim a
Dim t
Dim tmp
a = Array(0, 101, 107, 164, 102, 76, 232, 0, 57, 122, 139, 112, 36, 17, 205)
For j = 42 To 1 Step -1
tmp = a(14)
For i = 14 To 2 Step -1
a(i) = a(i - 1)
Next
a(1) = tmp
a(6) = 255 - a(6)
For x = 1 To 256
If (x * ((j * 2) + 1)) Mod 256 = a(5) Then
a(5) = x
Exit For
End If
Next
For x = 1 To 256
If (x * 49) Mod 256 = a(4) Then
a(4) = x
Exit For
End If
Next
tmp = a(3)
a(3) = a(2)
a(2) = tmp
For i = 14 To 1 Step -1
For x = 1 To 256
If (x + (j * a((i Mod 14) + 1))) Mod 256 = a(i) Then
a(i) = x Mod 256
Exit For
End If
Next
Next
Dim s
s = CStr(j) + ": "
For n = 1 To 14
s = s + Chr(a(n))
Next
Next
MsgBox s
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment