Encryption System

free web hosting
Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Encryption System

kvarnerexpress
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:
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

 

 

 


Reply

tuddy
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?

Reply

arboc7
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!!

Reply

Unregistered 015
I had a quick look at this code and dont have time for analysys. I can see it converts chars to coresponding nubmers after MD5, and back in decription (not sure tough).
What do you actually want to know (since you already gave decryption algorithm)?

Reply

Spectre
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.

Reply

vitrus
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 smile.gif

Reply

farsiscript
nice code dear kvarnerexpress
i 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

Reply

electron
Well nice one but use sha1() function rather than MD5().
But its a good one

Reply

Spectre
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.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : encryption

  1. Md5 Encryption :d - i love it (12)



Looking for encryption, system

Searching Video's for encryption, system
advertisement



Encryption System



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE