- var_dump: documentation ( source)
- bin2hex: documentation ( source)
- spl_object_hash: documentation ( source)
- random_bytes: documentation ( source)
<?php
class ZeroDayTechnique {
public function key($action = 'get', $value = null) {
static $hidden = [];
switch ($action) {
case 'get':
return $hidden[spl_object_hash($this)];
case 'set':
$hidden[spl_object_hash($this)] = $value;
break;
default:
throw new Exception('Wut in da hell');
}
}
}
$x = new ZeroDayTechnique;
$not_x = new ZeroDayTechnique;
$x->key('set', random_bytes(32));
var_dump(bin2hex($x->key('get')));
$not_z->key('set', random_bytes(32));
var_dump(bin2hex($x->key('get')));
var_dump(bin2hex($not_x->key('get')));
var_dump($x);