-
Notifications
You must be signed in to change notification settings - Fork 0
/
AuthTable.cs
59 lines (51 loc) · 1.73 KB
/
AuthTable.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HackerInsideOneTimePadGenerator {
public class AuthTable {
public static string getAuthTable(int blocchi) { // Implementare contatore
string ris = "";
string padID = RandomUtils.RandomString(5);
char[] alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
int cnt = 0;
string cntStr = "";
int min = 0, max = 10;
for (int i = 0; i < blocchi; i++) {
min = 0;
max = 10;
ris += "PAD: " + padID + "-" + i.ToString() + " \n";
for (int j = 0; j < 20; j++) {
for (int k = 0; k < 10; k++) {
if (k == 0 && cnt == 0) {
ris += createCounterString(min, max) + "\n";
min = max;
max += 10;
}
ris += RandomUtils.getRandomUniqueString(2, "") + " ";
}
ris += "\n";
cnt++;
if (cnt == 5) { // Spezza ogni 5 righe
ris += "\n\n";
cnt = 0;
}
}
}
return ris;
}
public static string createCounterString(int min, int max) {
string str = "";
int cnt = min;
while (cnt < max) {
if (cnt < 10)
str += "0" + cnt + " ";
else
str += cnt + " ";
cnt++;
}
return str;
}
}
}