Console.WriteLine("注意:Dec算法并不安全,请不要把他当作加密算法 请输入文件:") Dim file As String = Console.ReadLine() If IO.File.Exists(file) Then Console.WriteLine("请输入密码:") Dim password As UShort = Console.ReadLine().GetHashCode() And UShort.MaxValue Dim reader As New StreamReader(file) Dim strbulid As New StringBuilder("#DEC_ENC::") strbulid.Append(Encrypt("DecHacker Gen Dec File", code2) & "::" & Encrypt("XXX.XXX.XXX.XXX", code2) & "::" & Encrypt("ENCODED", password) & vbCrLf & Encrypt(reader.ReadToEnd(), password)) Console.WriteLine(strbulid.ToString()) End If Else Console.WriteLine("输入错误") Console.ReadKey() Main() End If Console.ReadKey() End Sub
Private Function Encrypt(data As String, passcode As UShort) As String Dim stringBuilder As StringBuilder = New StringBuilder() For i As Integer = 0 To data.Length - 1 Dim num As Integer = CInt((AscW(data(i)) * AscW("ܞ"c)) + AscW("翿"c) + passcode) stringBuilder.Append(CStr(num) + " ") Next Return stringBuilder.ToString().Trim() End Function ' Hacknet.FileEncrypter
Private Function Decrypt(data As String, passcode As UShort) As String Dim stringBuilder As StringBuilder = New StringBuilder() Dim array As String() = Split(data, " ") If String.IsNullOrWhiteSpace(data) Then Return "" For i As Integer = 0 To array.Length - 1 Dim num As Integer = Convert.ToInt32(array(i)) Dim num2 As Integer = 32767 Dim num3 As Integer = num - num2 - CInt(passcode) num3 /= 1822 stringBuilder.Append(ChrW(num3)) Next Return stringBuilder.ToString().Trim() End Function