Skip to content

Instantly share code, notes, and snippets.

@chezsick
Last active December 18, 2018 19:24
Show Gist options
  • Save chezsick/aee943eab972af1b707b52044e8281ab to your computer and use it in GitHub Desktop.
Save chezsick/aee943eab972af1b707b52044e8281ab to your computer and use it in GitHub Desktop.
Generate Parameter Encoding VideoCrypt And Nagravision Syster For CryptImage
<?php
$tp = $argv[1];
$demi = boolval($argv[2]);
$n = 0;
while ($o = fread(STDIN,4))
{
$offset1 = ord($o[0]);
$increment1 = (intval(ord($o[1])/2)*2)+1;
if ($demi)
{
$offset2 = ord($o[2]);
$increment2 = (intval(ord($o[3])/2)*2)+1;
}
else
{
$offset2 = $offset1;
$increment2 = $increment1;
}
$n = $n + 1;
echo "frame ".$n.";".$tp.";".$offset1.";".$increment1.";".$offset2.";".$increment2."\n";
}
<?php
$start = $argv[1];
$end = $argv[2];
while ($o = fread(STDIN,3))
{
$a = ((ord($o[2])*pow(256,2))+(ord($o[1])*pow(256,1))+(ord($o[0])*pow(256,0)))+1;
echo $a.";".$start.";".$end."\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment