Developers.Hash.Formats

From Shareaza Wiki
Revision as of 20:09, 20 June 2009 by Kevogod (talk | contribs) (1 revision)
Jump to navigation Jump to search

Hash text and URI formats

Instead of trying to produce every possibility, show the possiblites that camper's code supports, which are the only ones you would actually want, anyway.

<source lang="c"> CString md5string = md5value.toString(); // "5d41402abc4b2a76b9719d911017c592" CString md5shorturn = md5value.toShortUrn(); // "md5:5d41402abc4b2a76b9719d911017c592" CString md5urn = md5value.toUrn(); // "urn:md5:5d41402abc4b2a76b9719d911017c592"

CString sha1string = sha1value.toString(); // "VL2MMHO4YXUKFWV63YHTWSBM3GXKSQ2N" CString sha1shorturn = sha1value.toShortUrn(); // "sha1:VL2MMHO4YXUKFWV63YHTWSBM3GXKSQ2N" CString sha1urn = sha1value.toUrn(); // "urn:sha1:VL2MMHO4YXUKFWV63YHTWSBM3GXKSQ2N"

CString tigerstring = tigervalue.toString(); // "HGHPJWCDKPF6B6BRUZCBR4YBFJKBSSKHE4MG53I" CString tigershorturn = tigervalue.toShortUrn(); // "tree:tiger/:HGHPJWCDKPF6B6BRUZCBR4YBFJKBSSKHE4MG53I" CString tigerurn = tigervalue.toUrn(); // "urn:tree:tiger/:HGHPJWCDKPF6B6BRUZCBR4YBFJKBSSKHE4MG53I"

CString donkeystring = donkeyvalue.toString(); // "866437cb7a794bce2b727acc0362ee27" CString donkeyshorturn = donkeyvalue.toShortUrn(); // "ed2k:866437cb7a794bce2b727acc0362ee27" CString donkeyurn = donkeyvalue.toUrn(); // "urn:ed2khash:866437cb7a794bce2b727acc0362ee27" </source>

MD5 is base 16 lowercase, with headers md5: and urn:md5: SHA1 is base 32 uppercase, with headers sha1: and urn:sha1: TigerTree is base 32 uppercase, with headers tree:tiger/: and urn:tree:tiger/: eDonkey2000 is base 16 lowercase, with headers ed2k: and urn:ed2khash: