www_archline_hu/cadline/backend/maintenance/encodetest.php
LÁZÁR Imre AI Agent c2cf6dab13 feat(cadline): add common_cadline_libraries + maintenance backend
common_cadline_libraries (CRM hardlock/db/users classes; upstream cadline_web/cadcommonlib), maintenance/ (ARCHLine.XP license backend; upstream cadline_web/maintenance), maintenance2/. Vetted live files (byte-truth); upstream repos in PROVENANCE.md. NOTE: could be git submodules — kept as live files for byte-fidelity.

Signed-off-by: LÁZÁR Imre <imre@illusion.hu>
Assisted-by: claude-code@claude-opus-4-8
2026-07-16 11:34:30 +02:00

40 lines
1.3 KiB
PHP

<?php
//echo $_GET["key"];
if (!class_exists('crm_hardlock')) require_once("common_cadline_libraries/crm_hardlock.class.php");
$action = trim(strtolower($_GET['encode']));
switch ($action) {
case 'true': {
$data = crm_hardlock::encode($_GET["privateKey"], $_GET["publicKey"], "Use std::stringstream to convert integers into strings and its special");
echo $data;
break;
}
case 'false': {
//header('Content-type: text/html; charset=utf-8');
$data = crm_hardlock::decode($_GET["privateKey"], $_GET["publicKey"], $_GET["data"]);
echo $data;
//echo crmHelper::decode($_GET["privateKey"], $_GET["publicKey"], $_GET["data"]);
break;
}
}
/*
public static function encode($string,$key) {
$key = sha1($key);
$strLen = strlen($string);
$keyLen = strlen($key);
for ($i = 0; $i < $strLen; $i++) {
$ordStr = ord(substr($string,$i,1));
if ($j == $keyLen) { $j = 0; }
$ordKey = ord(substr($key,$j,1));
$j++;
$hash .= strrev(base_convert(dechex($ordStr + $ordKey),16,36));
}
return $hash;
}
*/