Cl'
Cl'

Reputation: 1653

hashing file in custom pattern

Fairly simple. How can I make a single function to create a multi-valued hashed url.

So for example *getfile.mysite.ltd/file/dl.php?file_id=10101* is alright but I do not want to disclose file_id. For such reason I am fetching files via universal file hash that is stored in SQL. Which is a MD5 of the files name.

Here is how the thing looks in my SQL record

 my-vacation-image.jpg -> b16f48c6cfd73bb9bfb058c95175537f

but I wan't to make it bit more complex as examle below

 my-vacation-image.jpg -> ce591714-d1e8-46d5-bbfa-23b45bea81e2

Any ideas or suggestions as to how?

Upvotes: 0

Views: 81

Answers (1)

ualinker
ualinker

Reputation: 745

$dashedHash = implode('-', str_split($hash, 5));

Upvotes: 1

Related Questions