Created
April 10, 2022 08:32
-
-
Save muratcakmaksoftware/605c1530dffe26319015b468ff5f167c to your computer and use it in GitHub Desktop.
Basit Şifrelemeyi Maskeleme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$char = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","="); | |
$charEncrypt = array("!1","!2","!3","!4","!5","!6","#0","#1","#3","#4","#5","#6","$1","$2","#3","$4","$5","$6","%1","%2","%3","%4","%5","%6","<1","<2","<3","<4","<5","<6","&1","&2","&3","&4","&5","&6","+1","+2","+3","+4","+5","+6","*1","*2","*3","*4","*5","*6","-1","-2","-3","-4","$9"); | |
$testData = 'test'; | |
echo $testData.'<br/>'; | |
//Encryption | |
$encryption = base64_encode($testData); //data base64 şifrelenir. | |
echo 'Base64: '.$encryption.'<br/>'; | |
//Base64 karakterleri kendi şifreniz ile değiştirilir. | |
for($i = 0; $i < count($char); $i++){ | |
$encryption = str_replace($char[$i], $charEncrypt[$i], $encryption); | |
} | |
echo 'Encrypted: '.$encryption.'<br/>'; | |
//Decryption | |
$decryption = $encryption; | |
//Kendi şifrelemeniz base64 karakterlerine geri alınır. | |
for($i = 0; $i < count($char); $i++){ | |
$decryption = str_replace($charEncrypt[$i], $char[$i], $decryption); | |
} | |
echo 'Decrypted: '.$decryption.'<br/>'; | |
$decryption = base64_decode($decryption); //base64 decode edilir. | |
echo $decryption; | |
/* | |
Output: | |
test | |
Base64: dGVzdA== | |
Encrypted: !4&3*6<2!4<3$9$9 | |
Decrypted: dGVzdA== | |
test | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment