[go: up one dir, main page]

Menu

[c8c5c8]: / ROXter / functions.cs  Maximize  Restore  History

Download this file

89 lines (69 with data), 2.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.IO;
using System.Text;
using winForms = System.Windows.Forms;
namespace ROXter
{
class functions
{
public static long keyer (string key, string subkey)
{
long result;
string prom;
char[] ff = key.ToCharArray();
int a = Convert.ToInt32(ff[0]) * Convert.ToInt32(ff[5]);
int b = Convert.ToInt32(ff[1]) * Convert.ToInt32(ff[4]);
int c = Convert.ToInt32(ff[2]) * Convert.ToInt32(ff[3]);
if (subkey != "")
{
prom = Convert.ToString(a) + Convert.ToString(b) + Convert.ToString(c) + Convert.ToString(ff[3]);
result = Convert.ToInt64(prom) ^ Convert.ToInt64(subkey);
return result;
}
else
{
prom = Convert.ToString(a) + Convert.ToString(c) + Convert.ToString(b) + Convert.ToString(ff[3]);
result = Convert.ToInt64(prom);
return result;
}
}
public static string textcrypt(string text, string key, string subkey)
{
long kkey = keyer(key, subkey);
byte[] arr1 = Encoding.Unicode.GetBytes(text);
byte[] bytes = new byte[arr1.Length];
for (int i = 0; i < bytes.Length; i++)
{
bytes[i] = (byte)(arr1[i] ^ kkey);
}
return Encoding.Unicode.GetString(bytes);
}
public static void filecrypt(string path, string key, string subkey)
{
long kkey = keyer(key, subkey);
byte[] arr1 = File.ReadAllBytes(path);
byte[] bytes = new byte[arr1.Length];
for (int i = 0; i < bytes.Length; i++)
{
bytes[i] = (byte)(arr1[i] ^ kkey);
}
File.WriteAllBytes(path, bytes);
}
public static void foldercrypt(string path, string key, string subkey)
{
int a = 0;
long kkey = keyer(key, subkey);
string[] ss = Directory.GetFiles(path);
while (a < ss.Length)
{
byte[] arr1 = File.ReadAllBytes(ss[a]);
byte[] bytes = new byte[arr1.Length];
for (int i = 0; i < bytes.Length; i++)
{
bytes[i] = (byte)(arr1[i] ^ kkey);
}
File.WriteAllBytes(ss[a], bytes);
}
}
}
}