Unser Unternehmen
- Kompetenz
- Erfahrung
- Beratung
Key = array(11, 42, -13, 5, 67, -23, -45, 12, 24, 34, 56, -55);
$this->List = array();
// Add all necessary characters to $List
// Add all numbers (0-9)
for ($i = 48; $i < 58; $i++) {
array_push($this->List, $i);
}
// Add all upper-case letters (A-Z)
for ($i = 97; $i < 123; $i++) {
array_push($this->List, $i);
}
// Add all lower-case letters (a-z)
for ($i = 65; $i < 91; $i++) {
array_push($this->List, $i);
}
// Add certain special characters at random positions
array_splice($this->List, 10, 0, 40);
array_splice($this->List, 12, 0, 41);
array_splice($this->List, 30, 0, 91);
array_splice($this->List, 32, 0, 93);
array_splice($this->List, 40, 0, 47);
array_splice($this->List, 42, 0, 92);
array_splice($this->List, 50, 0, 38);
array_splice($this->List, 52, 0, 46);
array_splice($this->List, 3, 0, 44);
array_splice($this->List, 13, 0, 59);
array_splice($this->List, 23, 0, 58);
array_splice($this->List, 33, 0, 45);
array_splice($this->List, 43, 0, 95);
array_splice($this->List, 53, 0, 63);
array_splice($this->List, 55, 0, 64);
}
public function runCrypt($text, $direction) {
$result = array();
$textAsByte = unpack('C*', $text);
// var_dump($textAsByte);
$pos = 0;
$offset = 0;
$iPos = 0;
$x = 0;
foreach($textAsByte as &$byte) {
if (in_array($byte, $this->List)) {
$iPos = $x % count($this->Key);
$offset = $this->Key[$iPos];
// Encode
if ($direction == 1) {
$pos = array_search($byte, $this->List) + $offset;
} else {
$pos = array_search($byte, $this->List) - $offset;
}
if ($pos > count($this->List) - 1) {
$pos = $pos - count($this->List);
} else if ($pos < 0) {
$pos = count($this->List) + $pos;
}
array_push($result, $this->List[$pos]);
} else {
array_push($result, $byte);
}
$x++;
}
return $this->toCharacters($result);
}
private function toCharacters($characters) {
$result = "";
foreach($characters as $i) {
$result = $result . chr($i);
}
return $result;
}
}
$_NAME = $_POST['FirstName'] . ' ' . $_POST['LastName'];
$_EMAIL = $_POST['Email'];
$_CUSTOMERNO = '11111';
if (isset($_POST['CustomerNo'])) {
$_CUSTOMERNO = $_POST['CustomerNo'];
}
$_VERSION = $_POST['Version'];
$date = new DateTime();
$date->add(new DateInterval('P30D'));
$expiryDate = $date->format('dmY');
$keyDecrypted = $_NAME . '@@@' . $_EMAIL . '@@@2.8.*.*@@@' . $_CUSTOMERNO . $expiryDate . '6144y';
$crypt = new Crypt();
echo $crypt->runCrypt($keyDecrypted, 1);
?>
case-team GmbH
Kontaktieren Sie uns gerne.
Telefon
Tel.: +49 2166 27887 20 Fax: +49 2166 27887 19
in**@*******am.de
Unsere Anschrift
case-team GmbH Nobelstraße 3 – 5 41189 Mönchengladbach
Key = array(11, 42, -13, 5, 67, -23, -45, 12, 24, 34, 56, -55);
$this->List = array();
// Add all necessary characters to $List
// Add all numbers (0-9)
for ($i = 48; $i < 58; $i++) {
array_push($this->List, $i);
}
// Add all upper-case letters (A-Z)
for ($i = 97; $i < 123; $i++) {
array_push($this->List, $i);
}
// Add all lower-case letters (a-z)
for ($i = 65; $i < 91; $i++) {
array_push($this->List, $i);
}
// Add certain special characters at random positions
array_splice($this->List, 10, 0, 40);
array_splice($this->List, 12, 0, 41);
array_splice($this->List, 30, 0, 91);
array_splice($this->List, 32, 0, 93);
array_splice($this->List, 40, 0, 47);
array_splice($this->List, 42, 0, 92);
array_splice($this->List, 50, 0, 38);
array_splice($this->List, 52, 0, 46);
array_splice($this->List, 3, 0, 44);
array_splice($this->List, 13, 0, 59);
array_splice($this->List, 23, 0, 58);
array_splice($this->List, 33, 0, 45);
array_splice($this->List, 43, 0, 95);
array_splice($this->List, 53, 0, 63);
array_splice($this->List, 55, 0, 64);
}
public function runCrypt($text, $direction) {
$result = array();
$textAsByte = unpack('C*', $text);
// var_dump($textAsByte);
$pos = 0;
$offset = 0;
$iPos = 0;
$x = 0;
foreach($textAsByte as &$byte) {
if (in_array($byte, $this->List)) {
$iPos = $x % count($this->Key);
$offset = $this->Key[$iPos];
// Encode
if ($direction == 1) {
$pos = array_search($byte, $this->List) + $offset;
} else {
$pos = array_search($byte, $this->List) - $offset;
}
if ($pos > count($this->List) - 1) {
$pos = $pos - count($this->List);
} else if ($pos < 0) {
$pos = count($this->List) + $pos;
}
array_push($result, $this->List[$pos]);
} else {
array_push($result, $byte);
}
$x++;
}
return $this->toCharacters($result);
}
private function toCharacters($characters) {
$result = "";
foreach($characters as $i) {
$result = $result . chr($i);
}
return $result;
}
}
$_NAME = $_POST['FirstName'] . ' ' . $_POST['LastName'];
$_EMAIL = $_POST['Email'];
$_CUSTOMERNO = '11111';
if (isset($_POST['CustomerNo'])) {
$_CUSTOMERNO = $_POST['CustomerNo'];
}
$_VERSION = $_POST['Version'];
$date = new DateTime();
$date->add(new DateInterval('P30D'));
$expiryDate = $date->format('dmY');
$keyDecrypted = $_NAME . '@@@' . $_EMAIL . '@@@2.8.*.*@@@' . $_CUSTOMERNO . $expiryDate . '6144y';
$crypt = new Crypt();
echo $crypt->runCrypt($keyDecrypted, 1);
?>