Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

Encryption System

Recommended Posts

Just for fun, I made my own encryption system. I was wondering if people had any suggestions or could write code to break it.

Code for encryption system, use amfrencrypt() to encrypt and amfrdecrypt() to decrypt
PHP Code:

function amfrencrypt($string, $password){    $password = md5($password);    $encnum = 0;    for($k = 0; $k < strlen($password); $k++)    {        if(is_string($password{$k}))        {            $encnum += ord($password{$k});        }    }    if($encnum == 0)    {        die('Invlaid password!');    }    for ($i = 0; $i < strlen($string); $i++)    {        $str[] = $string{$i};    }    $count = count($str);    for($j = 0; $j < $count; $j++)    {        $encstr[] = ord($str[$j]) * $encnum;    }    $return = implode(':', $encstr);    return $return;}function amfrdecrypt($string, $password){    $password = md5($password);    $str = explode(':', $string);    $encnum = 0;    for($k = 0; $k < strlen($password); $k++)    {        if(is_string($password{$k}))        {            $encnum += ord($password{$k});        }    }    if($encnum == 0)    {        die('Invlaid password!');    }    $count = count($str);    for($j = 0; $j < $count; $j++)    {        $encstr[] = chr($str[$j] / $encnum);    }    $return = implode('', $encstr);    return $return;}

I am not planning to use this encryptions system, and if you do, please dont sue me if someone decrypts all your data!

kvarnerexpress

Share this post


Link to post
Share on other sites

Showing the source code also makes it just that little easier for people to 'conflict' with the code to break it. Are you asking people to break so you can make it better? or so you can see how ood your skills are?

Share this post


Link to post
Share on other sites

Your script looks pretty good...but I generally use a one-way hash (MD5 or the one built into MySQL) for all of my encrypting, but, then again, I never have to decrypt anything...I wonder if anyone will actually attempt to break your code/script.Good coding!!

Share this post


Link to post
Share on other sites

It's primarily relying on MD5 to provide security, so really, it's not an 'encryption system' in itself. If you stripped out its reliance on MD5 and constructed your own hashing function, then maybe it could be titled as such.

 

But anyway, it's simple enough, and still effective. It obviously works by adding up the ASCII character codes for the MD5 hash, then multiplying the character code for each character in the string by this value. This makes it quite difficult to reverse the method, and uncover the actual text without the password.

Share this post


Link to post
Share on other sites

Yes, if you want to encrypt a small piece of text (In php I was thinking about a personal (private) message or something.Than you have two excellent functions over here ^_^

Share this post


Link to post
Share on other sites

nice code dear kvarnerexpressi need more info about 2 functions : amfrencrypt() and amfrdecrypt() i look at in php.net but i can understand this functions if you have tutorial or one good soruce like your soruce plz post here thanks all

Share this post


Link to post
Share on other sites

Wow, this thread is certainly old.farsiscript, what are you asking exactly? The functions are obviously custom, so they aren't going to be on PHP.net (or in many other locations)... you'll just have to get information on them by looking at the source code above.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.