|
 |
|
ขอคำแนะนำ echo ออกมาเป็น text ไม่เข้าใจการถอดรหัส |
|
 |
|
|
 |
 |
|
ไม่เข้าใจในการถอดรหัสครับ รบกวนช่วยแนะนำการ ถอดหน่อยครับว่าทำอย่างไร
ข้อความที่เข้ารหัส
CP3cbzkILuQUjkIINektSSwk6MDAfFvtbg17I4zhFB1iNqpX7J0mXXCHRqbOME3AdnTbRrRCSvtGdnh8gErriqzyJS8zJRaOYpIKEuVWRQ24tLrsW2yA4OKRJOGTMLfx7qFf7CoDPZcbTvYCuUoalJu1yZHTWV3AEEX/tV8GLcx3/MklMy+ZpWAQHtn0SW/2y1dUFpdPoB6BEpiaDUdLYz27BOtnKVQZf2bTZmANTqA=[/code]
ฟังก์ชั่นที่เข้ารหัส 1
[code]function encrypt($string) {
$key = '69&3jV39sA!H#uZC33';
$result = '';
for($i=0; $i<strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key))-1, 1);
$char = chr(ord($char)+ord($keychar));
$result.=$char;
}
$results = base64_encode($result);
$results = strtr($results, '+/', '-_');
$results = str_replace('=', '', $results);
return $results;
}
ฟังก์ชั่นที่เข้ารหัส 2
<?php
//You can change this gKey with your own (32 characters).
$gKey = 'welcometoapicodesdotcomthisiskey';
function decode($pData)
{
global $gKey;
$lData = str_replace(' ','+', $pData);
$lBase64Decoded_Payload = base64_decode($lData);
$lEncrypted_PlainText = substr($lBase64Decoded_Payload, 16);
$lIV = substr($lBase64Decoded_Payload, 0, 16);
$lDecrypted_PlainText = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $gKey, $lEncrypted_PlainText, MCRYPT_MODE_CBC, $lIV);
$lBase64Decoded_PlainText = base64_decode($lDecrypted_PlainText);
return $lBase64Decoded_PlainText;
}
function encode($pData)
{
global $gKey;
$lBase64Encoded_PlainText = base64_encode($pData);
$lIV = GenerateIV();
$lEncrypted_PlainText = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $gKey, $lBase64Encoded_PlainText, MCRYPT_MODE_CBC, $lIV);
$lPayload = $lIV.$lEncrypted_PlainText;
$lBase64Encoded_Payload = base64_encode($lPayload);
return $lBase64Encoded_Payload;
}
function GenerateIV()
{
$lIV = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM);
while(strlen($lIV) < 16)
{
$lIV .= "\0";
}
return $lIV;
}
?>
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2018-09-19 23:09:52 |
By :
92928 |
View :
735 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ถ้ารหัสผ่านที่มีพวก Token Key มักจะถอดกลับมาได้ไม่เหมือนเดิมครับ ถ้าคีย์ไม่เหมือนกัน
|
 |
 |
 |
 |
Date :
2018-09-20 21:17:57 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|