|
static byte[] | StringToByteArray (string s) |
|
static bool | ByteArrayEquals (byte[] b1, int offset1, byte[] b2, int offset2, int length) |
|
static string | MD5Sum (string path) |
| Calculates the MD5 sum of a file. More...
|
|
static string | MD5Sum (byte[] data) |
| Calculates the MD5 sum of the data in a byte array. More...
|
|
◆ ByteArrayEquals()
static bool BrawlLib.BrawlManagerLib.ByteUtilities.ByteArrayEquals |
( |
byte[] |
b1, |
|
|
int |
offset1, |
|
|
byte[] |
b2, |
|
|
int |
offset2, |
|
|
int |
length |
|
) |
| |
|
inlinestatic |
27 {
28 for (int subindex = 0; subindex < length; subindex++)
29 {
30 if (b1[subindex + offset1] != b2[subindex + offset2])
31 {
32 return false;
33 }
34 }
35
36 return true;
37 }
◆ MD5Sum() [1/2]
static string BrawlLib.BrawlManagerLib.ByteUtilities.MD5Sum |
( |
byte[] |
data | ) |
|
|
inlinestatic |
Calculates the MD5 sum of the data in a byte array.
58 {
59 byte[] hash = md5provider.ComputeHash(data);
60 StringBuilder sb = new StringBuilder();
61 foreach (byte b in hash)
62 {
63 sb.Append(b.ToString("x2").ToLower());
64 }
65
66 return sb.ToString();
67 }
◆ MD5Sum() [2/2]
static string BrawlLib.BrawlManagerLib.ByteUtilities.MD5Sum |
( |
string |
path | ) |
|
|
inlinestatic |
Calculates the MD5 sum of a file.
45 {
46 if (File.Exists(path))
47 {
48 return MD5Sum(File.ReadAllBytes(path));
49 }
50
51 return "File not found";
52 }
static string MD5Sum(string path)
Calculates the MD5 sum of a file.
Definition: ByteUtilities.cs:44
◆ StringToByteArray()
static byte[] BrawlLib.BrawlManagerLib.ByteUtilities.StringToByteArray |
( |
string |
s | ) |
|
|
inlinestatic |
12 {
13 char[] numbers = (from c in s
14 where char.IsLetterOrDigit(c)
15 select c).ToArray();
16 byte[] b = new byte[numbers.Length / 2];
17 for (int i = 0; i < b.Length; i++)
18 {
19 string num = numbers[2 * i] + "" + numbers[2 * i + 1];
20 b[i] = Convert.ToByte(num, 16);
21 }
22
23 return b;
24 }
The documentation for this class was generated from the following file:
- BrawlLib/BrawlManagerLib/ByteUtilities.cs