Skip to content

Instantly share code, notes, and snippets.

View fadhil-riyanto's full-sized avatar
🏠
Learning for JLPT

Fadhil Riyanto fadhil-riyanto

🏠
Learning for JLPT
View GitHub Profile
@fadhil-riyanto
fadhil-riyanto / encode_decode.php
Created May 14, 2021 04:19 — forked from LogIN-/encode_decode.php
PHP custom encode decode functions
<?php
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++;