Skip to content

Instantly share code, notes, and snippets.

@hasherezade
Created March 19, 2017 00:11
Show Gist options
  • Select an option

  • Save hasherezade/ee1959152287a66ce55b7dce83a248bc to your computer and use it in GitHub Desktop.

Select an option

Save hasherezade/ee1959152287a66ce55b7dce83a248bc to your computer and use it in GitHub Desktop.
Diamond Fox Crystal code fragments
Public Sub decrypt(str1_arg, str2_arg) '406ABC
'Data Table: 401634
Dim str2_len As Long
Dim var_B6 As Integer
Dim index As Long
Dim var_B4 As Long
On Error Resume Next
str1 = StrConv(str1_arg, &H80, 0)
str2 = StrConv(str2_arg, &H80, 0)
str2_len = UBound(str2, 1)
For _indx = 0 To &HFF : indx1 = _indx 'Long
var_A0(indx1) = CInt(indx1)
Next _indx 'Long
For _indx = &H100 To &H11D : indx1 = _indx 'Long
var_A0(indx1) = CInt(indx1 Xor &H100)
Next _indx 'Long
For _indx = 1 To 6 : indx1 = _indx 'Long
var_A0((indx1 + &HF9)) = CInt(str2((str2_len - indx1)))
var_A0((indx1 - 1)) = CInt(str2((indx1 - 1))) Xor (255 - CInt(str2((str2_len - indx1))))
Next _indx 'Long
var_B6 = 0
var_B4 = 0
For _indx2 = 0 To UBound(str1, 1) : indx1 = _indx2 'Long
If (0 > str2_len) Then
index = 0
End If
If ((var_B4 > &H11D) And (var_B6 = 0)) Then
var_B4 = 0
var_B6 = Not (var_B6)
End If
If ((var_B4 > &H11D) And (var_B6 = &HFF)) Then
var_B4 = 5
var_B6 = Not (var_B6)
End If
str1(indx1) = CByte(CInt(str1(indx1)) Xor var_A0(var_B4) Xor CInt(str2(index)))
index = (index + 1)
var_B4 = (var_B4 + 1)
Next _indx2 'Long
var_88 = CStr(StrConv(str1, &H40, 0))
Exit Sub
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment