<?php

/*
	sessions.lib.php
	Jason M. Knight, December 2014
	
	Sets up sessions and allows easy creation of form checking hashes
*/

session_start();
session_regenerate_id();

function hashCreate($name) {
	return $_SESSION[$name] = bin2hex(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM));
}

function hashExists($name, $hash) {
	return isset($_SESSION[$name]) && ($_SESSION[$name] == $hash);
}

?>