Skip to Content.
Sympa Menu

microid - Re: [Microid] MicroID Python code + comments on the spec

microid AT lists.ibiblio.org

Subject: Microid mailing list

List archive

Chronological Thread  
  • From: jer <jeremie AT jabber.org>
  • To: Peter Saint-Andre <stpeter AT jabber.org>
  • Cc: microid AT lists.ibiblio.org
  • Subject: Re: [Microid] MicroID Python code + comments on the spec
  • Date: Wed, 3 Jan 2007 14:59:36 -0600

You're catching newlines in your files:

booker:~ jer$ openssl dgst -sha1 ent1.txt
SHA1(ent1.txt)= 6438d67faaaf7803f4dd47df5e9406cd0bb232fe
booker:~ jer$ hexdump -c ent1.txt
0000000 x m p p : s t p e t e r @ j a b
0000010 b e r . o r g \n


On Jan 3, 2007, at 2:40 PM, Peter Saint-Andre wrote:

Eran Sandler wrote:
Hey all,
Attached is a simple function implementation of microid in Python (after
seeing the Java implementation I had to do something ;-) ).
This sample is for Python 2.4 or so (in 2.5 the SHA API I'm using is
deprecated, so when I'll install it I'll submit a Python 2.5 valid sample).
It also contains a sample that you can run it by itself (and not include it
in a project). Run by specifying:
python microid.py firsturi seconduri
Where firsturi is the first uri you want to encode and the second is the
second.
For example:
python microid.py xmpp:stpeter AT jabber.org https://www.xmpp.net/
This will produce (with the '======' lines):
===================================================================== ===
first uri : xmpp:stpeter AT jabber.org
second uri : https://www.xmpp.net/
microid hash value : 6196ea6709be2a4cbdf2bc0cfaeac491f2fb8921
microid :
xmpp+https:sha1:6196ea6709be2a4cbdf2bc0cfaeac491f2fb8921
===================================================================== ===
For the value of the microid printed, it will try to extract the protocol
used form the uris given in the input.
This also brings me to another point. I might be wrong on this, but I double
checked the hash values and the sample on the spec has the wrong hash
values. The ones I've listed above is the right ones (as far as I could
tell).
So it would be good to correct the sample so that people will be able to
verify that their sha1 hashing (at least for now) is working well.

Here is how I generated the examples:

1. Create a file ent1.txt whose only content is:

xmpp:stpeter AT jabber.org

2. Run the following command:

openssl dgst -sha1 ent1.txt

3. Get the following output:

6438d67faaaf7803f4dd47df5e9406cd0bb232fe

4. Create a file ent2.txt whose only content is:

https://www.xmpp.net/

5. Run the following command:

openssl dgst -sha1 ent2.txt

6. Get the following output:

d2d7361de77be843f0480000e09619ba56142ad3

7. Create a file inputs.txt whose content is a concatenation of the two hashes:

6438d67faaaf7803f4dd47df5e9406cd0bb232fed2d7361de77be843f0480000e09619 ba56142ad3

8. Run the following command:

openssl dgst -sha1 inputs.txt

9. Get the following output:

bd3f7a2cea6e6013067293d9efb11e7b0ece829e

Which seems to follow the generation method described at http:// microid.org/microid.html#generation

But I freely admit that I may be missing something. :-)

Peter

--
Peter Saint-Andre
Jabber Software Foundation
http://www.jabber.org/people/stpeter.shtml

_______________________________________________
Microid mailing list
Microid AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/microid





Archive powered by MHonArc 2.6.24.

Top of Page