There are a number of ways to approach this. Some sites use the idea of a "slug", which usually involves making the title of the video valid for a URL. Instead of a url like this:
insert_video.php?video_tut_id=15
... you end up with a url like this:
insert_video.php?video_tut=how-to-make-cookies
Something like this:
function slug($str) {
$str = strtolower(trim($str));
$str = preg_replace('/[^a-z0-9-]/', '-', $str);
$str = preg_replace('/-+/', "-", $str);
return $str;
}
Another method is to give each video a non-numeric "alias". This is pretty similar to the slug method, but instead of using the title, you can use a keyword or random letters and numbers.
The approach that you mention, which is making some reversible hash out of the id, is easily accomplished in a variety of ways, depending on how hard you want it to be to decrypt. If you need high security, there are options like using the mCrypt
library (docs). If security isn't a high concern, you can use any obscure method - a user might figure it out if they tried, but if they aren't going to get anything out of the work more exciting than the id you used in your database table, it isn't likely many who are capable would bother.
Simple methods like the latter could be as easy as converting the numbers to letters with chr
(docs). You could use a "Caesar cipher" and shift all the numbers and pass the key right in the url (again, this is a low-security approach). Google around and choose one of the numerous home-baked encryption methods - all of these are non-secure but good enough for some simple obfuscation.
With all that said, and not knowing your use case, it is often not very important to go though such pains to hide the id from your user. You'll want your various scripts to implement security whether you hide these id numbers from your users or not - getting the id number should not give a would-be attacker anything important. If it is dangerous for users to get these ids, I suggest that you reconsider your security model and identify why having an id number gives someone the "keys to the kingdom" - it shouldn't, not at all, *especially if the ID numbers comprise a portion of the URLs you will be exposing to the public. If the id field is important enough to go through such pains to hide, you'd be better served by never exposing it, encrypted or not.