<commit_before><?php
function shuffle_string($str = null)
{
	if (!is_null($str))
	{
		$str_array = str_split(trim($str));
		shuffle($str_array);
		foreach ($str_array as $key => $char)
		{
			if (empty($char) || $char == ' ')
			{
				unset($str_array[$key]);
			}
		}
		$str = implode('', $str_array);
		return $str;
	}
	else
	{
		return FALSE;
	}
}
function strToHex($string)
{
    $hex = '';
    for ($i=0; $i<strlen($string); $i++){
        $ord = ord($string[$i]);
        $hexCode = dechex($ord);
        $hex .= substr('0'.$hexCode, -2);
    }
    return strToUpper($hex);
}
if (isset($_POST['stringToEncrypt']))
{
	$results = array(
		'Encryption' => array(
			'MD5 Hash' => md5($_POST['stringToEncrypt']),
			'SHA1 Hash' => sha1($_POST['stringToEncrypt']),
			'Base64 Encode' => base64_encode($_POST['stringToEncrypt']),
			'Hex Encode' => strToHex($_POST['stringToEncrypt']),
			),
		'Formats' => array(
			'Shuffled' => shuffle_string($_POST['stringToEncrypt']),
			'Uppercase' => strtoupper($_POST['stringToEncrypt']),
			'Lowercase' => strtolower($_POST['stringToEncrypt']),
			)
		);
}
?>
<html>
<head>
	<title>String Functions - JamieHoward.co </title>
	<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
	<style type="text/css">
		.encrypt-form-button {margin-top: 15px;}
		.panel-body {overflow: scroll; font-size: .85em;}
		.panel-content {margin-right: 15px;}
	</style>
</head>
<body>
	<div class="container">
		<div class="row-fluid">
			<h1 class="header">String functions</h1> 
			<form action="./index.php" class="form-horizontal" method="POST">
				<div class="control-group">
					<label for="string-to-encrypt" class="control-label">String to encrypt</label>
					<textarea id="string-to-encrypt" name="stringToEncrypt" class="form-control"><?php if ($_POST['stringToEncrypt']) { echo $_POST['stringToEncrypt']; } ?></textarea>
				</div>
				<div class="control-group">
					<input id="encrypt-submit-button" type="submit" value="Transform!" class="btn btn-primary encrypt-form-button"/>
					<a href="./index.php" target="_self" class="btn btn-warning encrypt-form-button">Reset</a>
				</div>
			</form><commit_msg>Changed label for string input<commit_after><?php
function shuffle_string($str = null)
{
	if (!is_null($str))
	{
		$str_array = str_split(trim($str));
		shuffle($str_array);
		foreach ($str_array as $key => $char)
		{
			if (empty($char) || $char == ' ')
			{
				unset($str_array[$key]);
			}
		}
		$str = implode('', $str_array);
		return $str;
	}
	else
	{
		return FALSE;
	}
}
function strToHex($string)
{
    $hex = '';
    for ($i=0; $i<strlen($string); $i++){
        $ord = ord($string[$i]);
        $hexCode = dechex($ord);
        $hex .= substr('0'.$hexCode, -2);
    }
    return strToUpper($hex);
}
if (isset($_POST['stringToEncrypt']))
{
	$results = array(
		'Encryption' => array(
			'MD5 Hash' => md5($_POST['stringToEncrypt']),
			'SHA1 Hash' => sha1($_POST['stringToEncrypt']),
			'Base64 Encode' => base64_encode($_POST['stringToEncrypt']),
			'Hex Encode' => strToHex($_POST['stringToEncrypt']),
			),
		'Formats' => array(
			'Shuffled' => shuffle_string($_POST['stringToEncrypt']),
			'Uppercase' => strtoupper($_POST['stringToEncrypt']),
			'Lowercase' => strtolower($_POST['stringToEncrypt']),
			)
		);
}
?>
<html>
<head>
	<title>String Functions - JamieHoward.co </title>
	<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
	<style type="text/css">
		.encrypt-form-button {margin-top: 15px;}
		.panel-body {overflow: scroll; font-size: .85em;}
		.panel-content {margin-right: 15px;}
	</style>
</head>
<body>
	<div class="container">
		<div class="row-fluid">
			<h1 class="header">String functions</h1> 
			<form action="./index.php" class="form-horizontal" method="POST">
				<div class="control-group">
					<label for="string-to-encrypt" class="control-label">String to transform</label>
					<textarea id="string-to-encrypt" name="stringToEncrypt" class="form-control"><?php if ($_POST['stringToEncrypt']) { echo $_POST['stringToEncrypt']; } ?></textarea>
				</div>
				<div class="control-group">
					<input id="encrypt-submit-button" type="submit" value="Transform!" class="btn btn-primary encrypt-form-button"/>
					<a href="./index.php" target="_self" class="btn btn-warning encrypt-form-button">Reset</a>
				</div>
			</form>
{'fraction_non_alphanumeric': 0.21069397042093288, 'fraction_numerical': 0.010011376564277589, 'mean_word_length': 4.277310924369748, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6141771', 'n_tokens_mistral': 1763, 'n_tokens_neox': 1585, 'n_words': 279}