<?php

namespace App\Http\Controllers;

class EncriptadorTPV
{
	private $salt_length;
	
	function __construct(){
		$this->salt_length=10;
	}
	
	public function salt(){
		
		return substr(md5(uniqid(rand(), true)), 0, $this->salt_length);
		
	}
	
	public function hash_encript($clave){
		
		$salt = $this->salt();
		
		$password = $salt . substr(sha1($salt .$clave), 0, -$this->salt_length);
		
		return $password;
		
	}
	
	
}