Skip to content
Snippets Groups Projects
Commit 34886453 authored by Zandor Smith's avatar Zandor Smith :computer:
Browse files

Just use all hashing algorithems PHP has available, but select SHA1 by default.

parent fa7fa1f3
No related branches found
No related tags found
No related merge requests found
<?php
$methods = hash_algos();
$hash = null;
if(isset($_POST['input']) && isset($_POST['type'])) {
$input = $_POST['input'];
$type = strtolower($_POST['type']);
if(in_array($type, hash_algos())) {
if(in_array($type, $methods)) {
$hash = hash($type, $input);
} else {
$hash = "Not-supported hashing method selected";
......@@ -46,11 +47,8 @@ if(isset($_POST['input']) && isset($_POST['type'])) {
<select class="form-control" name="type" id="type">
<?php
$methods = array(
"sha1", "sha256", "sha384", "sha512", "md2", "md5"
);
foreach($methods as $method) {
if(isset($_POST['type']) && $method == $_POST['type']) {
if((isset($_POST['type']) && $method == $_POST['type']) || (!isset($_POST['type']) && $method == "sha1")) {
echo "<option value='$method' selected>$method</option>";
} else {
echo "<option value='$method'>$method</option>";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment