mirror of
https://github.com/unraid/webgui.git
synced 2026-03-07 18:39:27 -06:00
Encryption benchmark: highlight default settings
This commit is contained in:
@@ -10,6 +10,12 @@
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
list($luks,$size,$hash,$rng) = explode(',',exec("/usr/sbin/cryptsetup --help|tail -1"));
|
||||
$luks = str_replace('-plain64','',trim(explode(':',$luks)[1]));
|
||||
$size = str_replace(' bits','',trim(explode(':',$size)[1]));
|
||||
$hash = trim(explode(':',$hash)[1]);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@@ -26,7 +32,7 @@ var test = 'sha1,sha256,sha512,ripemd160,whirlpool,aes-cbc:128,serpent-cbc:128,t
|
||||
|
||||
function benchmark(index,last){
|
||||
if (index > last) return;
|
||||
$.get('/webGui/include/update.crypto.php',{index:index,test:test},function(data){
|
||||
$.get('/webGui/include/update.crypto.php',{index:index,test:test,luks:'<?=$luks?>:<?=$size?>',hash:'<?=$hash?>'},function(data){
|
||||
$('pre').append(data);
|
||||
benchmark(index+1,last);
|
||||
});
|
||||
|
||||
@@ -17,11 +17,17 @@ if ($index < count($tests)) {
|
||||
$test = $tests[$index];
|
||||
list($name,$size) = explode(':',$test);
|
||||
if (!$size) {
|
||||
$default = $test==$_GET['hash'];
|
||||
if ($index>0) $test .= '|tail -1';
|
||||
echo shell_exec("/usr/sbin/cryptsetup benchmark -h $test");
|
||||
if ($default) echo "<b>";
|
||||
echo preg_replace(['/^(# Tests.*\n)/','/\n$/'],["$1\n",""],shell_exec("/usr/sbin/cryptsetup benchmark -h $test"));
|
||||
echo $default ? " (default)</b>\n" : "\n";
|
||||
} else {
|
||||
$default = $test==$_GET['luks'];
|
||||
if ($index>5) $size .= '|tail -1';
|
||||
echo preg_replace('/^# Tests.*\n/',"\n",shell_exec("/usr/sbin/cryptsetup benchmark -c $name -s $size"));
|
||||
if ($default) echo "<b>";
|
||||
echo preg_replace(['/^# Tests.*\n/','/\n$/'],["\n",""],shell_exec("/usr/sbin/cryptsetup benchmark -c $name -s $size"));
|
||||
echo $default ? " (default)</b>\n" : "\n";
|
||||
}
|
||||
} else {
|
||||
$bm = popen('/usr/sbin/cryptsetup --help','r');
|
||||
@@ -32,6 +38,6 @@ if ($index < count($tests)) {
|
||||
elseif (strpos($text,'LUKS1:')!==false) echo str_replace("\t"," ",$text);
|
||||
}
|
||||
pclose($bm);
|
||||
echo "<div style='text-align:center'><input type='button' value='Done' onclick='top.Shadowbox.close()'></div>";
|
||||
echo "<div style='text-align:center;margin-top:12px'><input type='button' value='Done' onclick='top.Shadowbox.close()'></div>";
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user