I would like to create a custom algorithm for encrypting and decrypting strings of data. I want the algorithm to allow two parameters:

  1. Custom salt string for the algorithm to use to create custom encrypted strings of the data.
  2. The data to be encrypted / decrypted.

I don't want to use any php set functions cause they are crackable. I want to learn how to create a custom algorithm from scratch and custom code.

Thanks for any help.

<?php
$password="RimoRocks";
$salt="YesForSure";
$encryptedPassword=crypt($password,$salt);
// SQL Stuff: extract password from database and save to $passwordFromDatabase here
if($passwordFromDatabase==$encryptedPassword)
{
   // passwords match
}
else
{
  // passwords do not match
}
?>

Simplest way ... to make your script,
you can create few levels encrypt
for example first step can be $md5pass = md5($pass) second $encryptpass = crypt($md5pass, $salt)

Regards
Rimo

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.