[Microid] PHP code for generating MicroID

eran at yedda.com eran at yedda.com
Sat Jan 6 17:29:00 EST 2007


Hey all,

This is a very simple PHP page with a PHP function that generates MicroIDs.

<?php

function generate_microid($firstUri, $secondUri) {
	$firstUriHash = sha1($firstUri);
	$secondUriHash = sha1($secondUri);

	return sha1($firstUriHash . $secondUriHash);
}


$firstUri = "xmpp:stpeter at jabber.org";
$secondUri = "https://www.xmpp.net/";

?>


<div>First Uri : <? echo $firstUri; ?></div>
<div>Second Uri: <? echo $secondUri; ?></div>
<div>MicroID: <? echo generate_microid($firstUri, $secondUri); ?>
</div>

After writing the MicroID plugin for WordPress (http://eran.sandler.co.il/microid-wordpress-plugin/) I thought it would be useful to post it as an example as well (even though its VERY trivial ;-) ).

Eran


More information about the Microid mailing list