generateKey($username); for ($i = 0; $i < strlen($str); $i++) { $karakter = substr($str, $i, 1); $kuncikarakter = substr($kunci, ($i % strlen($kunci)), 1); $karakter = chr(ord($karakter) + ord($kuncikarakter)); $hasil .= $karakter; } return urlencode(base64_encode($hasil)); } public function decryptMe($str, $username) { $str = base64_decode(urldecode($str)); $hasil = ''; $kunci = $this->generateKey($username); for ($i = 0; $i < strlen($str); $i++) { $karakter = substr($str, $i, 1); $kuncikarakter = substr($kunci, ($i % strlen($kunci)), 1); $karakter = chr(ord($karakter) - ord($kuncikarakter)); $hasil .= $karakter; } return $hasil; } public function encryptKpdl($str, $genKey) { $hasil = ''; $kunci = $genKey; for ($i = 0; $i < strlen($str); $i++) { $karakter = substr($str, $i, 1); $kuncikarakter = substr($kunci, ($i % strlen($kunci)), 1); $karakter = chr(ord($karakter) + ord($kuncikarakter)); $hasil .= $karakter; } return urlencode(base64_encode($hasil)); } public function decryptKpdl($str, $genKey) { $str = base64_decode(urldecode($str)); $hasil = ''; $kunci = $genKey; for ($i = 0; $i < strlen($str); $i++) { $karakter = substr($str, $i, 1); $kuncikarakter = substr($kunci, ($i % strlen($kunci)), 1); $karakter = chr(ord($karakter) - ord($kuncikarakter)); $hasil .= $karakter; } return $hasil; } public function encryptMeMawas($str) { $hasil = ''; $salt = "generateFromDMPToMawasSince26082024"; $kunci = $this->generateKey($salt); for ($i = 0; $i < strlen($str); $i++) { $karakter = substr($str, $i, 1); $kuncikarakter = substr($kunci, ($i % strlen($kunci)), 1); $karakter = chr(ord($karakter) + ord($kuncikarakter)); $hasil .= $karakter; } return urlencode(base64_encode($hasil)); } public function decryptMeMawas($str) { $str = base64_decode(urldecode($str)); $hasil = ''; $salt = "generateFromDMPToMawasSince26082024"; $kunci = $this->generateKey($salt); for ($i = 0; $i < strlen($str); $i++) { $karakter = substr($str, $i, 1); $kuncikarakter = substr($kunci, ($i % strlen($kunci)), 1); $karakter = chr(ord($karakter) - ord($kuncikarakter)); $hasil .= $karakter; } return $hasil; } }