Lexer->addSpecialPattern('\[\[SHA3:[^]]*\]\]',$mode,'plugin_sha3sum'); } // Trim Match function handle($match, $state, $pos, Doku_Handler $handler){ $ret = urlencode(substr($match,7,-2)); // trim {{SHA3> from start and }} from end return $ret; } // Render output public function render($mode, Doku_Renderer $renderer, $data) { // $data is the result of handle if($mode == 'xhtml'){ if (version_compare(phpversion(), '7.2.0', 'ge')) { $hash = hash('sha3-512' , $data); // SHA3 support in php 7.2 } else { require_once(realpath(dirname(__FILE__)).'/Sha3.php'); // extenal lib under MIT license $hash = Sha3::hash($data, 512); } $renderer->doc .= 'SHA3-512:

'.substr($hash,0,64).'
'.substr($hash,64).'

'; return true; } return false; } } //Setup VIM: ex: et ts=4 enc=utf-8 :