-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.html
executable file
·157 lines (130 loc) · 4.38 KB
/
data.html
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<html>
<head>
<!-- Resources -->
<script src="https://www.amcharts.com/lib/4/core.js"></script>
<script src="https://www.amcharts.com/lib/4/charts.js"></script>
<script src="https://www.amcharts.com/lib/4/themes/animated.js"></script>
<script src="./results/datafile.js"></script>
<script src="./results/estimated_datafile.js"></script>
<h1 id="warning"></h1>
<h1>Blue: our testdata</br>
Red: the data from the estimated formula</h1>
<h1>Normal graph</h1>
<div id="chartdiv2"></div>
<h1>Logarithmic graph</h1>
<div id="chartdiv"></div>
<br>
<h1 id="formula_placeholder"></h1>
<h2 id="formula_calculator_placeholder"></h1>
<script>
if(typeof formula !== "undefined"){
document.getElementById("formula_placeholder").innerHTML = "The estimated formula is: <p id='formula'></p>";
document.getElementById("formula").innerHTML = formula;
document.getElementById("formula_calculator_placeholder").innerHTML = "Estimate how long it takes to crack a key of a specific amount of bits here: <input id='bits' type='number' onchange='check()'></input></br></h2><h2 id='result'>"
function check(){
bits = document.getElementById("bits").value;
console.log(b*Math.pow(g, bits));
document.getElementById("result").innerHTML = "It would take "+(b*Math.pow(g, bits))+" seconds to crack a key that's "+bits+" bits long.";
}
}
if(typeof estimated_imported_data == "undefined"){
document.getElementById("warning").innerHTML += "Please run aproximate_formula.py, there's currently no formula to extrapolate the data</br>";
}
if(typeof imported_data == "undefined"){
document.getElementById("warning").innerHTML += "Please run the generate_datafile.py, there's currently no datafile.js</br>";
}
</script>
<!-- Styles -->
<style>
#warning {
color: #FF0000;
font-size: 60px;
}
#chartdiv {
width: 80%;
height: 300px;
}
#chartdiv2 {
width: 80%;
height: 300px;
}
</style>
<!-- Chart code -->
<script>
// Themes begin
am4core.useTheme(am4themes_animated);
// Themes end
// Create chart instance
var chart = am4core.create("chartdiv2", am4charts.XYChart);
// Create axes
var bitsAxis = chart.xAxes.push(new am4charts.ValueAxis());
bitsAxis.renderer.minGridDistance = 20;
bitsAxis.title.text = "Bits of the privatekey"
var timeAxis = chart.yAxes.push(new am4charts.ValueAxis());
timeAxis.renderer.minGridDistance = 20;
timeAxis.title.text = "Time in seconds"
// Create series
if(typeof imported_data !== "undefined"){
var series = chart.series.push(new am4charts.LineSeries());
series.data = imported_data
series.dataFields.valueY = "time";
series.dataFields.valueX = "bits";
series.tensionX = 0.84;
series.tensionY = 0.84;
series.strokeWidth = 9;
}
if(typeof estimated_imported_data !== "undefined"){
var series2 = chart.series.push(new am4charts.LineSeries());
series2.data = estimated_imported_data
series2.dataFields.valueY = "time";
series2.dataFields.valueX = "bits";
series2.tensionX = 0.84;
series2.tensionY = 0.84;
series2.strokeWidth = 3;
series2.stroke = "#FF0000";
}
// Add scrollbar
chart.scrollbarX = new am4core.Scrollbar();
</script>
<script>
// Themes begin
am4core.useTheme(am4themes_animated);
// Themes end
// Create chart instance
var chart = am4core.create("chartdiv", am4charts.XYChart);
// Create axes
var bitsAxis = chart.xAxes.push(new am4charts.ValueAxis());
bitsAxis.renderer.minGridDistance = 20;
bitsAxis.title.text = "Bits of the privatekey"
var timeAxis = chart.yAxes.push(new am4charts.ValueAxis());
timeAxis.logarithmic = true;
timeAxis.renderer.minGridDistance = 20;
timeAxis.title.text = "Time in seconds"
// Create series
if(typeof imported_data !== "undefined"){
var series = chart.series.push(new am4charts.LineSeries());
series.data = imported_data
series.dataFields.valueY = "time";
series.dataFields.valueX = "bits";
series.tensionX = 0.84;
series.tensionY = 0.84;
series.strokeWidth = 9;
}
if(typeof estimated_imported_data !== "undefined"){
var series2 = chart.series.push(new am4charts.LineSeries());
series2.data = estimated_imported_data
series2.dataFields.valueY = "time";
series2.dataFields.valueX = "bits";
series2.tensionX = 0.84;
series2.tensionY = 0.84;
series2.strokeWidth = 3;
series2.stroke = "#FF0000";
}
// Add scrollbar
chart.scrollbarX = new am4core.Scrollbar();
</script>
</head>
<body>
<!-- HTML -->
</body>
</html>