Reputation: 1017
I am using an video embed code (Similar to youtube's embed code) and I would like to Encrypt or hash a part of the code (The Video id or filename of the video). It is important to me that a user that views the source code of the page wont be able to view those items. Is there a way I can do so? Any recommendation?
I'd add that my site is using php.
For example, here is an youtube embed code:
<object width="420" height="315"><param name="movie" value="http://www.youtube.com/v/fRgWBN8yt_E?hl=en_US&version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/fRgWBN8yt_E?hl=en_US&version=3" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>
Lets say I would want to change the part:
value="http://www.youtube.com/v/fRgWBN8yt_E?hl=en_US&version=3">
Into:
value="sdfj8435437fjdfs8458543(Some Kind of hashing or encryption)">
Thanks,
Nimi
Upvotes: 2
Views: 6660
Reputation: 565
Step -1 ) Convert ASCII VALUE To Hexadecimal
ASCII VALUE - http://www.youtube.com/v/fRgWBN8yt_Ehl=en_US&version=3
HexaDecimal VALUE - 68 74 74 70 3a 2f 2f 77 77 77 2e 79 6f 75 74 75 62 65 2e 63 6f 6d 2f 76 2f 66 52 67 57 42 4e 38 79 74 5f 45 3f 68 6c 3d 65 6e 5f 55 53 26 61 6d 70 3b 76 65 72 73 69 6f 6e 3d 33
Step - 2) Replace Spaces with % ie - 68%74%74%70%3a%2f%2f%77%77%77%2e%79%6f%75%74%75%62%65%2e%63%6f%6d%2f%76%2f%66%52%67%57%42%4e%38%79%74%5f%45%3f%68%6c%3d%65%6e%5f%55%53%26%61%6d%7%3b%76%65%72%73%69%6f%6e%3d%33
step - 3) use javascript function unescape('68%74%74%70%3a%2f%2f%77%77%77%2e%79%6f%75%74%75%62%65%2e%63%6f%6d%2f%76%2f%66%52%67%57%42%4e%38%79%74%5f%45%3f%68%6c%3d%65%6e%5f%55%53%26%61%6d%7%3b%76%65%72%73%69%6f%6e%3d%33');
step -4 ) example - unescape('%67%6f%6f%67%6c%65%2e%63%6f%6d')">Test i.e these is for opening google.com
in your case use
<object width="420" height="315"><param name="movie" value="<script>unescape('68%74%74%70%3a%2f%2f%77%77%77%2e%79%6f%75%74%75%62%65%2e%63%6f%6d%2f%76%2f%66%52%67%57%42%4e%38%79%74%5f%45%3f%68%6c%3d%65%6e%5f%55%53%26%61%6d%7%3b%76%65%72%73%69%6f%6e%3d%33</script>"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/fRgWBN8yt_E?hl=en_US&version=3" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>
Upvotes: -1
Reputation: 6346
I assume you don't want the user to find the video in YouTube or some other video sharing platform.
Well, that is indeed impossible if the video is open to the public. Instead, consider using Vimeo Plus, where you can hide the uploaded videos from the public and only allow embedding in a white list of predefined URLs
Upvotes: -1
Reputation: 887385
That is completely, fundamentally impossible.
No matter what you do, the user can see the final result in the inspector or network tab.
Instead, you can place a single-use token in the URL so that it will only work once.
Upvotes: 9