Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $data = $_GET['pass'];//get password
- $key = '1234567890123456';
- function encrypt($data, $key){
- return base64_encode(
- mcrypt_encrypt(
- MCRYPT_RIJNDAEL_128,
- $key,
- $data,
- MCRYPT_MODE_CBC,
- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
- )
- );
- }
- function decrypt($data, $key){
- $decode = base64_decode($data);
- return mcrypt_decrypt(
- MCRYPT_RIJNDAEL_128,
- $key,
- $decode,
- MCRYPT_MODE_CBC,
- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
- );
- }
- echo $encrypted = encrypt($data, $key);
- echo $decrypted= decrypt($encrypted, $key);
- //Encoding and decoding with str_rot13()
- function enrot13($enrot13){
- return str_rot13($enrot13);
- }
- function derot13($derot13){ //decode
- return str_rot13(str_rot13($derot13));
- }
- //Encode and decode with base64_encode() & base64_decode()
- function enbase64($enstring){
- return base64_encode($enstring);
- }
- function debase64($destring){ //decode
- return base64_decode((base64_encode($destring));
- }
- //Deflate and inflate with gzdeflate() & gzinflate()
- function gzinflate($string){
- return gzdeflate($string);
- }
- function gzdeflate($string){ //decode
- return gzinflate($string);
- }
- //first two functions — str_rot13() and base64_encode()
- function gzinflateRot13($string){
- return gzdeflate($string, 9);// compression level set to 9 = maximum
- }
- function gzdeflateRot13($string){ //decode
- return gzinflate(gzdeflate($string, 9), strlen($string));// length set to same as $string
- }
- //Combined example: gzinflate(str_rot13(base64_decode()))
- function allthre($string){
- return eval(gzinflate(str_rot13(base64_decode($string))));
- }
- //Php url encode and decode
- function enUrl($string){
- return urlencode($string);
- }
- function deUrl($string){ //decode
- return urldecode($string);
- }
- //PHP string to hex and hex to string functions
- function strToHex($string)
- {
- $hex='';
- for ($i=0; $i < strlen($string); $i++)
- {
- $hex .= dechex(ord($string[$i]));
- }
- return $hex;
- }
- function hexToStr($hex) //decode
- {
- $string='';
- for ($i=0; $i < strlen($hex)-1; $i+=2)
- {
- $string .= chr(hexdec($hex[$i].$hex[$i+1]));
- }
- return $string;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement