# php encryption

**URL:** <https://www.phphelp.com/t/php-encryption/23162>\
**Category:** Security and PHP\
**Created:** [July 30, 2014, 11:35am UTC](https://www.phphelp.com/t/php-encryption/23162 "2014-07-30T11:35:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreamseeker](https://www.phphelp.com/letter_avatar_proxy/v4/letter/d/a88e4f/32.png) [@dreamseeker](https://www.phphelp.com/u/dreamseeker)\
**Post date:** [July 30, 2014, 11:35am UTC](https://www.phphelp.com/t/php-encryption/23162/1 "2014-07-30T11:35:42Z")

</div>

hi guys, i must to solve a problem but i don’t know where i should start

i need to encrypt an url : [https://redirector.googlevideo.com/videoplayback?requiressl=yes&shardbypass=yes&cmbypass=yes&id=85447e8dcca62496&itag=37&source=picasa&cmo=secure\_transport%3Dyes&ip=0.0.0.0&ipbits=0&expire=1409263315&sparams=requiressl,shardbypass,cmbypass,id,itag,source,ip,ipbits,expire&signature=9502110CBD5EB672BEFED7A42BB71A1A0040EA3F.AF8F7074D3EA1B7EF034923F51B139F96E1EB386&key=lh1&cpn=o641DPR2ifWhwWA1&c=web&cver=html5](https://redirector.googlevideo.com/videoplayback?requiressl=yes&shardbypass=yes&cmbypass=yes&id=85447e8dcca62496&itag=37&source=picasa&cmo=secure_transport%3Dyes&ip=0.0.0.0&ipbits=0&expire=1409263315&sparams=requiressl,shardbypass,cmbypass,id,itag,source,ip,ipbits,expire&signature=9502110CBD5EB672BEFED7A42BB71A1A0040EA3F.AF8F7074D3EA1B7EF034923F51B139F96E1EB386&key=lh1&cpn=o641DPR2ifWhwWA1&c=web&cver=html5) that will be played through jwplayer.

that url is a redirector of google so if you click you will see i need to have something like that i have found browsing on google:

http://r20—googlevideo.com/picasa/redirect.php?encrypt=0f10fd0fd0f90c30b80b80fb0ee0ed0f20fb0ee0ec0fd0f80fb0b70f00f80f80f00f50ee0ff0f20ed0ee0f80b70ec0f80f60b80ff0f20ed0ee0f80f90f50ea1020eb0ea0ec0f40c80f20ed0c60bc0bc0bc0be0c00bb0c00c00c10ed0bf0ed0ee0b90bb0bb0af0f20fd0ea0f00c60bb0bb0af0fc0f80fe0fb0ec0ee0c60f90f20ec0ea0fc0ea0af0ec0f60f80c60fc0ee0f70fc0f20fd0f20ff0ee0e80ec0f80f70fd0ee0f70fd0ae0bc0cd1020ee0fc0af0f20f90c60b90b70b90b70b90b70b90af0f20 etc etc…

so what type of snippet should i put in my html file to have a similar result?

thanks again

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [July 30, 2014, 3:15pm UTC](https://www.phphelp.com/t/php-encryption/23162/2 "2014-07-30T15:15:32Z")

</div>

Do you actually need it encrypted or just encoded? You can use base64 encode and decode if you dont need actual encryption.

---

<div class="post-metadata">

**Author:** ![dreamseeker](https://www.phphelp.com/letter_avatar_proxy/v4/letter/d/a88e4f/32.png) [@dreamseeker](https://www.phphelp.com/u/dreamseeker)\
**Post date:** [July 30, 2014, 3:21pm UTC](https://www.phphelp.com/t/php-encryption/23162/3 "2014-07-30T15:21:07Z")

</div>

ok thanks for your quick response as you have understand i’m new in this things so how i can do the “hiding” of that url, i need to put this in html file that play a jwplayer

so i want hide/encrypt/obfuscate/encode i don’t know what is the best practice the file link and put something this:

file:“http://r20—googlevideo.com/picasa/redirect.php?encrypt=0f10fd0fd0f90c30b80b80fb0ee0ed0f20fb0ee0ec0fd0f80fb0b70f00f80f80f00f50ee0ff0f20ed0ee0f80b70ec0f80f60b80ff0f20ed0ee0f80f90f50ea1020eb0ea0ec0f40c80f20ed0c60bc0bc0bc0be0c00bb0c00c00c10ed0bf0ed0ee0b90bb0bb0af0f2”

can you suggest me how?

---

<div class="post-metadata">

**Author:** ![dreamseeker](https://www.phphelp.com/letter_avatar_proxy/v4/letter/d/a88e4f/32.png) [@dreamseeker](https://www.phphelp.com/u/dreamseeker)\
**Post date:** [July 30, 2014, 3:46pm UTC](https://www.phphelp.com/t/php-encryption/23162/4 "2014-07-30T15:46:52Z")

</div>

i should to encrypt that url i see a lot of base64 url encoder i think that teh sample is encrypted can you suggest how to do? i want to put a code snippet (that i will obscure in JS) inside the html file.

Thanks

🙂

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [July 30, 2014, 3:49pm UTC](https://www.phphelp.com/t/php-encryption/23162/5 "2014-07-30T15:49:03Z")

</div>

> can you suggest me how?

I told you how. Did you not even look it up?

> **[LMGTFY](https://lmgtfy.com/?q=php+base64+encode)**
>
> Let Me Google That For You (LMGTFY): for all those people who find it more convenient to bother you with their question rather than search it for themselves.

---

<div class="post-metadata">

**Author:** ![dreamseeker](https://www.phphelp.com/letter_avatar_proxy/v4/letter/d/a88e4f/32.png) [@dreamseeker](https://www.phphelp.com/u/dreamseeker)\
**Post date:** [July 30, 2014, 4:17pm UTC](https://www.phphelp.com/t/php-encryption/23162/6 "2014-07-30T16:17:29Z")

</div>

thanks for your suggest on how to use, but ,forgive me, i’m newbie in that things so can u help me on how to build the snippet of code to do that?

I found this through your link

[php]\<?php  
function base64url\_encode($data) {  
return rtrim(strtr(base64\_encode($data), ‘+/’, ‘-\_’), ‘=’);  
}

function base64url\_decode($data) {  
return base64\_decode(str\_pad(strtr($data, ‘-\_’, ‘+/’), strlen($data) % 4, ‘=’, STR\_PAD\_RIGHT));  
}  
?\>[/php]

but i don’t know how to build in fact the code that i need, i don’t waste your time Sir, so i need step by step to understand if u can guide me.

thanks again

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [July 30, 2014, 4:32pm UTC](https://www.phphelp.com/t/php-encryption/23162/7 "2014-07-30T16:32:41Z")

</div>

Your answer is in the first search result.

Example #1 base64\_encode() example

[php]\<?php  
$str = ‘This is an encoded string’;  
echo base64\_encode($str);  
?\>[/php]

The above example will output:

VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==

To use the function you posted:

echo base64url\_encode($str);  
And  
echo base64url\_decode($str);

---

<div class="post-metadata">

**Author:** ![dreamseeker](https://www.phphelp.com/letter_avatar_proxy/v4/letter/d/a88e4f/32.png) [@dreamseeker](https://www.phphelp.com/u/dreamseeker)\
**Post date:** [July 30, 2014, 4:43pm UTC](https://www.phphelp.com/t/php-encryption/23162/8 "2014-07-30T16:43:02Z")

</div>

ok…

so i put that function and i replace this ‘This is an encoded string’ with my original url and in jwplayer  
file : i call the "echo base64url\_decode($str) " function is correct?

Thanks

---

<div class="post-metadata">

**Author:** ![dreamseeker](https://www.phphelp.com/letter_avatar_proxy/v4/letter/d/a88e4f/32.png) [@dreamseeker](https://www.phphelp.com/u/dreamseeker)\
**Post date:** [July 31, 2014, 12:02pm UTC](https://www.phphelp.com/t/php-encryption/23162/9 "2014-07-31T12:02:41Z")

</div>

ok i have solved, thank you very much

😉
