note 109160 added to function.mcrypt-encrypt
| From: | p dot ranjitsingh at yahoo dot com | Date: | Mon, 25 Jun 2012 04:55:00 +0000 |
| Subject: | note 109160 added to function.mcrypt-encrypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188780@lists.php.net to get a copy of this message | ||
we can also create encrypt and decrypt function to make our data secure.
This is a simple example to make you understand that how we can make own encryption and decryption.
<?php
class Cipher
{
function encrypt($plain)
{
$length=strlen($plain);
for($i=0;$i<$length;$i++)
{
$temp[$i]=chr(ord($plain[$i])+$i*5);
}
$cipher=implode($temp);
return $cipher;
}
function decrypt($cipher)
{
$length=strlen($cipher);
for($i=0;$i<$length;$i++)
{
$temp[$i]=chr(ord($cipher[$i])-$i*5);
}
$plain=implode($temp);
return $plain;
}
}
?>
but we should note that when we create own encryption and decryption function then strength of
encryption depends on our logic that make data encrypted.
so make it powerful as you can.
Above example is a basic example and easy to understand by a professional hacker or a good
programmer.
----
Server IP: 59.162.86.123
Probable Submitter: 122.176.208.198
----
Manual Page -- http://www.php.net/manual/en/function.mcrypt-encrypt.php
Edit -- https://master.php.net/note/edit/109160
Del: integrated -- https://master.php.net/note/delete/109160/integrated
Del: useless -- https://master.php.net/note/delete/109160/useless
Del: bad code -- https://master.php.net/note/delete/109160/bad+code
Del: spam -- https://master.php.net/note/delete/109160/spam
Del: non-english -- https://master.php.net/note/delete/109160/non-english
Del: in docs -- https://master.php.net/note/delete/109160/in+docs
Del: other reasons-- https://master.php.net/note/delete/109160
Reject -- https://master.php.net/note/reject/109160
Search -- https://master.php.net/manage/user-notes.php