Graffiti list processor


This is my list processor it takes the commands MODULE, FUNCTION, DO, SET, UNSET, INPUT and ECHO (you can easily add more.). an example script would look like so:

MODULE hash.mod
// requires hash.mod
SET value hi
INPUT string
DO hash ($sglobals[string])
ECHO string
ECHO value
UNSET value
ECHO value
END;
if anyone is interested, here it is.

[Back to top]

<?php
/**
* Graffiti 2.0: list processor
* useage in  php: php -q graffiti.php [FILE] 
*/
$GLOBALS['StdinPointer']=fopen("php://stdin","r");
$null = `echo . > temp.dat`;
include("temp.dat");
echo "---\n";
function parse ($value1)
{ 
 $line=$value1;
 global $sglobals;
 if (preg_match("/(SET) ([A-Za-z0-9_.\/-]+) ([A-Za-z0-9_.\/-\=\(\)\"]+)/", $line, $matches)) {
     $sglobals[$matches[2]] = $matches[3];
 } elseif (preg_match("/(FUNCTION) ([A-Za-z0-9_.\/-\=]+)/", $line, $matches)) {
  fwrite (fopen ("temp.dat", "w"), "<?" . base64_decode($matches[2]) . "?>", strlen("<?" . base64_decode($matches[2]) . "?>"));
  include ("temp.dat");
    
 } elseif (preg_match("/(MODULE) ([A-Za-z0-9_.\/-\=\(\)\"]+)/", $line, $matches)) {
  $module = implode(' ', file($matches[2]));
  
  fwrite (fopen ("temp.dat", "w") ,"<?php " . base64_decode($module). "?>", strlen("<?php " . base64_decode($module). " ?>"));
  include ("temp.dat");
  
  
 } elseif (preg_match("/(DO) ([A-Za-z0-9_.\/-\=\(\)\"\[\]\,\$]+)/", $line, $matches)) {
  $return .= eval($matches[2].";") . "\n";
 } elseif (preg_match("/(UNSET) ([A-Za-z0-9_.\/-\=\(\)\"]+)/", $line, $matches)) {
  unset ($sglobals[$matches[2]]);
 } elseif (preg_match("/(INPUT) ([A-Za-z0-9_.\/-\=\(\)\"]+)/", $line, $matches)) {
  $sglobals[$matches[2]] = fgets($GLOBALS['StdinPointer'],255);
 } elseif (preg_match("/(END)\;/", $line, $matches)) {
  $return .= die("---");
 } elseif (preg_match("/(ECHO) ([A-Za-z0-9_.\/-\=\(\)\"]+)/", $line, $matches)) {
  if (isset($sglobals[$matches[2]])) {
      $return .= ($sglobals[$matches[2]]);
  } else {
      $sglobals[$temp] = $matches[2];
   $return .= ($sglobals[$temp]); 
   unset ($sglobals[$temp]);
  }
     $return .= "\n";
 } elseif (strstr($line, "//")) {
  $return .= "";
 } else {
  $return .= "Error: $line is not valid;\n";
 }
 fclose (fopen ("temp.dat", "w"));
 return $return;
}

if (!isset($argv[1])) {
    die ("usage: php -q graffiti [File]\n---");
}
$number = file($argv[1]);
$numbers = count($number);
for ($i=0; $i<$numbers; $i++)
{
print (parse($number[$i]));
}
@fclose($GLOBALS['StdinPointer']);
?>


JWP Hashing algorthim

This is my hashing algorthim. It creates a 32 bit md5 string of polynaminal of the string and then dose the same thing with that string thousands of times.
[Back to top]

<?
function jwp($hash, $depth)
{
 set_time_limit(0);
 $sh = base_convert(pi(),10,16);
 $hash = md5 ($hash);
 for ($i=0; $i<$depth; $i++)
 {
  for ($i=0; $i<1000; $i++)
  {
   $hash.=md5 (md5(crc32($hash)));
  }
  $hash2 = md5 ($hash);
  for ($i=0; $i<1000; $i++)
  {
   $hash2.=md5 (md5(crc32($hash2)));
  }
  $hash3 = md5 ($hash2);
  for ($i=0; $i<1000; $i++)
  {
   $hash3.=md5 (md5(crc32($hash3)));
  }
  $sh .= $hash.$hash2.$hash3;
  
 }
 return $sh;
}
?>
<?php
 function jwp($cdc381590,$cdc381592){set_time_limit(0);$cdc382592 = base_convert(pi(),10,16);$cdc381590=md5($cdc381590);for($i=0; $i<$cdc381592;$i++){for($i=0; $i<1000;$i++){$cdc381590.=md5(md5(crc32($cdc381590)));
 }$cdc3815902 = md5 ($cdc381590);for($i=0;$i<1000;$i++){$cdc3815902.=md5(md5(crc32($cdc3815902)));}$cdc3815903=md5($cdc3815902);
 for($i=0;$i<1000;$i++){$cdc3815903.=md5(md5(crc32($cdc3815903)));}$cdc382592.=$cdc381590.$cdc3815902.$cdc3815903;}return$cdc382592;}
 echo jwp("hello", 30);
?>

SourceForge Logo  Email: joel@digitalandmarks.com