php encryption


#1

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 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


#2

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


#3

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?


#4

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

:slight_smile:


#5
can you suggest me how?

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


#6

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


#7

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);


#8

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


#9

ok i have solved, thank you very much

:wink: