From: Robert K. <may...@us...> - 2001-12-05 18:43:55
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv19399/lib Modified Files: bitprint.c main.c Log Message: Fixed up the character set encoding and added support for the dot between the sha and tigertree hash. Index: bitprint.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/bitprint.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** bitprint.c 2001/12/05 09:02:31 1.2 --- bitprint.c 2001/12/05 18:43:52 1.3 *************** *** 24,35 **** { '0', 0xFF }, { '1', 0xFF }, ! { '2', 0x18 }, ! { '3', 0x19 }, ! { '4', 0x1A }, ! { '5', 0x1B }, ! { '6', 0x1C }, ! { '7', 0x1D }, ! { '8', 0x1E }, ! { '9', 0x1F }, { ':', 0xFF }, { ';', 0xFF }, --- 24,35 ---- { '0', 0xFF }, { '1', 0xFF }, ! { '2', 0x1A }, ! { '3', 0x1B }, ! { '4', 0x1C }, ! { '5', 0x1D }, ! { '6', 0x1E }, ! { '7', 0x1F }, ! { '8', 0xFF }, ! { '9', 0xFF }, { ':', 0xFF }, { ';', 0xFF }, *************** *** 50,68 **** { 'J', 0x09 }, { 'K', 0x0A }, ! { 'L', 0xFF }, ! { 'M', 0x0B }, ! { 'N', 0x0C }, ! { 'O', 0xFF }, ! { 'P', 0x0D }, ! { 'Q', 0x0E }, ! { 'R', 0x0F }, ! { 'S', 0x10 }, ! { 'T', 0x11 }, ! { 'U', 0x12 }, ! { 'V', 0x13 }, ! { 'W', 0x14 }, ! { 'X', 0x15 }, ! { 'Y', 0x16 }, ! { 'Z', 0x17 } }; --- 50,68 ---- { 'J', 0x09 }, { 'K', 0x0A }, ! { 'L', 0x0B }, ! { 'M', 0x0C }, ! { 'N', 0x0D }, ! { 'O', 0x0E }, ! { 'P', 0x0F }, ! { 'Q', 0x10 }, ! { 'R', 0x11 }, ! { 'S', 0x12 }, ! { 'T', 0x13 }, ! { 'U', 0x14 }, ! { 'V', 0x15 }, ! { 'W', 0x16 }, ! { 'X', 0x17 }, ! { 'Y', 0x18 }, ! { 'Z', 0x19 } }; *************** *** 173,181 **** { bitziEncodeBase32(bitprint, BITPRINT_RAW_LEN, base32Bitprint); } ! void bitziBitprintFromBase32(const char *base32Bitprint, unsigned char *bitprint) { bitziDecodeBase32(base32Bitprint, BITPRINT_BASE32_LEN, bitprint); } --- 173,190 ---- { bitziEncodeBase32(bitprint, BITPRINT_RAW_LEN, base32Bitprint); + memmove(base32Bitprint + SHA_BASE32SIZE + 1, + base32Bitprint + SHA_BASE32SIZE, TIGER_BASE32SIZE + 1); + base32Bitprint[SHA_BASE32SIZE] = '.'; } ! void bitziBitprintFromBase32(const char *base32BitprintWithDot, unsigned char *bitprint) { + char base32Bitprint[BITPRINT_BASE32_LEN + 1]; + + memcpy(base32Bitprint, base32BitprintWithDot, SHA_BASE32SIZE); + memcpy(base32Bitprint + SHA_BASE32SIZE, + base32BitprintWithDot + SHA_BASE32SIZE + 1, + TIGER_BASE32SIZE + 1); bitziDecodeBase32(base32Bitprint, BITPRINT_BASE32_LEN, bitprint); } Index: main.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/main.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -r1.38 -r1.39 *** main.c 2001/12/05 09:02:32 1.38 --- main.c 2001/12/05 18:43:52 1.39 *************** *** 722,727 **** b_bool ret = true; Context *context = NULL; - char *treeIndex; - char *treeIndexPlusOne; if (bitziBitprintInit(&bcontext) == -1) --- 722,725 ---- *************** *** 787,797 **** bitziBitprintFinal(&bcontext, bitprintRaw); bitziBitprintToBase32(bitprintRaw, bitprint); - - /* place period in middle of sha1 and tree */ - treeIndex = bitprint + 32; - treeIndexPlusOne = bitprint + 33; - memmove(treeIndexPlusOne, treeIndex, 39); - bitprint[32] = '.'; - bitprint[72] = '\0'; if (mcontext) --- 785,788 ---- |