Reputation: 5064
Is there a way to encrypt the filename of the css/js file? I notice that when I view source the website, the filename of the css and js files are encrypted like this.
<link href="/assets/css/builds/73e15c8a3cf6409214bbf8a742e9b5d41403226617.css" rel="stylesheet">
<script src="/assets/js/builds/217651bd25211390d62315e92b525f667014020626.js"></script>
Is there a script to do so?
Thanks in advance!
Upvotes: 1
Views: 1285
Reputation: 173642
This is typically part of a deployment step that aims to:
It does not add security in any way
Once the combined scripts/styles have been built, the contents is typically hashed using either md5() or sha1() and that hash becomes part of the file name; it provides a unique filename as well as prevent cache misses if the files didn't change.
I'm not aware of generic tools that perform this for you; I've written one for my own purposes, though, it's not rocket science after all.
Upvotes: 1
Reputation: 1502
Well, you could run an ordinary filename through a cryptographic hash function like MD5 (which should still be OK for something like this, but which has known weaknesses for use in digital signatures.)
If you run "standard" as in "standard.css" through MD5 using the tool at http://www.fileformat.info/tool/hash.htm you get c00f0c4675b91fb8b918e4079a0b1bac
. I'm not sure what this buys one, other than to obscure a name.
Edited to echo Jack's comment that you haven't really protected anything, just obscured a name, which is likely to make things harder on you, rather than on others!
Upvotes: 1