Hex Artifact Content
Not logged in

Artifact 73c68067469dea5ffea1b8c5b825d7a75f1d9424:

File www/base32.html part of check-in [dbda8d6ce9] - Initial check-in of m1 sources. by drh on 2007-07-21 14:10:57.

0000: 3c 68 74 6d 6c 3e 0a 3c 68 65 61 64 3e 0a 3c 74  <html>.<head>.<t
0010: 69 74 6c 65 3e 46 6f 73 73 69 6c 20 2d 20 42 61  itle>Fossil - Ba
0020: 73 65 2d 33 32 20 4e 61 6d 65 20 45 6e 63 6f 64  se-32 Name Encod
0030: 69 6e 67 3c 2f 74 69 74 6c 65 3e 0a 3c 2f 68 65  ing</title>.</he
0040: 61 64 3e 0a 3c 62 6f 64 79 20 62 67 63 6f 6c 6f  ad>.<body bgcolo
0050: 72 3d 22 77 68 69 74 65 22 3e 0a 3c 68 31 3e 42  r="white">.<h1>B
0060: 61 73 65 2d 33 32 20 4e 61 6d 65 20 45 6e 63 6f  ase-32 Name Enco
0070: 64 69 6e 67 3c 2f 68 31 3e 0a 0a 3c 70 3e 54 68  ding</h1>..<p>Th
0080: 65 20 6e 61 6d 65 20 6f 66 20 61 20 66 69 6c 65  e name of a file
0090: 20 6f 72 20 76 65 72 73 69 6f 6e 20 69 6e 20 66   or version in f
00a0: 6f 73 73 69 6c 20 69 73 20 74 68 65 0a 3c 61 20  ossil is the.<a 
00b0: 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f 65 6e 2e  href="http://en.
00c0: 77 69 6b 69 70 65 64 69 61 2e 6f 72 67 2f 77 69  wikipedia.org/wi
00d0: 6b 69 2f 53 48 41 2d 31 22 3e 53 48 41 2d 32 35  ki/SHA-1">SHA-25
00e0: 36 3c 2f 61 3e 20 68 61 73 68 20 6f 66 0a 74 68  6</a> hash of.th
00f0: 65 20 63 6f 6e 74 65 6e 74 20 6f 66 20 74 68 61  e content of tha
0100: 74 20 66 69 6c 65 20 6f 72 20 76 65 72 73 69 6f  t file or versio
0110: 6e 20 65 78 70 72 65 73 73 65 64 20 69 6e 20 61  n expressed in a
0120: 20 62 61 73 65 2d 33 32 20 0a 65 6e 63 6f 64 69   base-32 .encodi
0130: 6e 67 2e 20 20 54 68 65 20 64 69 67 69 74 73 20  ng.  The digits 
0140: 6f 66 20 74 68 65 20 62 61 73 65 2d 33 32 20 65  of the base-32 e
0150: 6e 63 6f 64 65 20 61 72 65 20 61 73 20 0a 66 6f  ncode are as .fo
0160: 6c 6c 6f 77 73 3a 0a 0a 3c 62 6c 6f 63 6b 71 75  llows:..<blockqu
0170: 6f 74 65 3e 3c 62 3e 0a 20 20 20 20 30 31 32 33  ote><b>.    0123
0180: 34 35 36 37 38 39 61 62 63 64 65 66 67 68 6a 6b  456789abcdefghjk
0190: 6d 6e 70 71 72 73 74 75 76 77 78 79 0a 3c 2f 62  mnpqrstuvwxy.</b
01a0: 3e 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a  ></blockquote>..
01b0: 3c 70 3e 54 68 65 20 6c 65 74 74 65 72 73 20 22  <p>The letters "
01c0: 6f 22 2c 20 22 69 22 2c 20 61 6e 64 20 22 6c 22  o", "i", and "l"
01d0: 20 61 72 65 20 6f 6d 69 74 74 65 64 20 66 72 6f   are omitted fro
01e0: 6d 20 74 68 65 0a 65 6e 63 6f 64 69 6e 67 20 63  m the.encoding c
01f0: 68 61 72 61 63 74 65 72 20 73 65 74 20 74 6f 20  haracter set to 
0200: 61 76 6f 69 64 20 63 6f 6e 66 75 73 69 6f 6e 20  avoid confusion 
0210: 77 69 74 68 20 74 68 65 20 0a 64 69 67 69 74 73  with the .digits
0220: 20 22 30 22 20 61 6e 64 20 22 31 22 2e 20 20 4f   "0" and "1".  O
0230: 6e 20 69 6e 70 75 74 2c 20 75 70 70 65 72 20 61  n input, upper a
0240: 6e 64 20 6c 6f 77 65 72 20 63 61 73 65 20 0a 6c  nd lower case .l
0250: 65 74 74 65 72 73 20 61 72 65 20 74 72 65 61 74  etters are treat
0260: 65 64 20 74 68 65 20 73 61 6d 65 2c 20 74 68 65  ed the same, the
0270: 20 6c 65 74 74 65 72 20 22 6f 22 20 69 73 20 0a   letter "o" is .
0280: 69 6e 74 65 72 70 72 65 74 65 64 20 61 73 20 61  interpreted as a
0290: 20 7a 65 72 6f 20 28 22 30 22 29 20 61 6e 64 20   zero ("0") and 
02a0: 74 68 65 20 6c 65 74 74 65 72 73 20 22 69 22 20  the letters "i" 
02b0: 61 6e 64 20 0a 22 6c 22 20 61 72 65 20 69 6e 74  and ."l" are int
02c0: 65 72 70 72 65 74 65 64 20 61 73 20 61 20 6f 6e  erpreted as a on
02d0: 65 20 28 22 31 22 29 2e 3c 2f 70 3e 0a 0a 3c 70  e ("1").</p>..<p
02e0: 3e 0a 45 61 63 68 20 63 68 61 72 61 63 74 65 72  >.Each character
02f0: 20 6f 66 20 74 68 65 20 62 61 73 65 2d 33 32 20   of the base-32 
0300: 65 6e 63 6f 64 69 6e 67 20 72 65 70 72 65 73 65  encoding represe
0310: 6e 74 73 20 35 20 62 69 74 73 0a 6f 66 20 74 68  nts 5 bits.of th
0320: 65 20 68 61 73 68 2e 20 20 54 68 65 20 66 69 72  e hash.  The fir
0330: 73 74 20 66 6f 75 72 20 62 69 74 73 20 6f 66 20  st four bits of 
0340: 74 68 65 20 53 48 41 32 35 36 20 68 61 73 68 20  the SHA256 hash 
0350: 61 72 65 0a 72 65 70 65 61 74 65 64 20 6f 6e 74  are.repeated ont
0360: 6f 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65  o the end of the
0370: 20 68 61 73 68 20 74 6f 20 6d 61 6b 65 20 74 68   hash to make th
0380: 65 20 68 61 73 68 20 61 20 6d 75 6c 74 69 70 6c  e hash a multipl
0390: 65 0a 6f 66 20 35 20 62 69 74 73 20 69 6e 20 6c  e.of 5 bits in l
03a0: 65 6e 67 74 68 2e 20 20 49 6e 20 74 68 69 73 20  ength.  In this 
03b0: 77 61 79 2c 20 74 68 65 20 66 69 6e 61 6c 20 64  way, the final d
03c0: 69 67 69 74 20 69 6e 20 74 68 65 0a 35 32 2d 64  igit in the.52-d
03d0: 69 67 69 74 20 62 61 73 65 2d 33 32 20 6e 75 6d  igit base-32 num
03e0: 62 65 72 20 72 65 70 72 65 73 65 6e 74 73 20 61  ber represents a
03f0: 20 66 75 6c 6c 20 35 20 62 69 74 73 2e 0a 3c 2f   full 5 bits..</
0400: 70 3e 0a 0a 3c 70 3e 41 73 20 61 6e 20 65 78 61  p>..<p>As an exa
0410: 6d 70 6c 65 2c 20 74 68 65 20 6e 61 6d 65 20 6f  mple, the name o
0420: 66 20 74 68 65 20 63 75 72 72 65 6e 74 20 68 65  f the current he
0430: 61 64 20 76 65 72 73 69 6f 6e 20 69 6e 0a 66 6f  ad version in.fo
0440: 73 73 69 6c 27 73 20 73 65 6c 66 2d 68 6f 73 74  ssil's self-host
0450: 69 6e 67 20 72 65 70 6f 73 69 74 6f 72 79 20 69  ing repository i
0460: 73 3a 3c 2f 70 3e 0a 0a 3c 62 6c 6f 63 6b 71 75  s:</p>..<blockqu
0470: 6f 74 65 3e 3c 62 3e 0a 20 20 20 20 77 6a 35 6e  ote><b>.    wj5n
0480: 6d 66 67 72 32 75 36 32 70 6e 6b 64 33 35 61 39  mfgr2u62pnkd35a9
0490: 33 68 37 34 38 31 77 32 75 74 64 6b 67 73 32 6d  3h7481w2utdkgs2m
04a0: 70 74 66 38 67 79 79 36 71 73 77 66 31 76 34 37  ptf8gyy6qswf1v47
04b0: 0a 3c 2f 62 3e 3c 2f 62 6c 6f 63 6b 71 75 6f 74  .</b></blockquot
04c0: 65 3e 0a 0a 3c 70 3e 46 6f 73 73 69 6c 20 75 73  e>..<p>Fossil us
04d0: 65 73 20 74 68 65 20 66 75 6c 6c 20 35 32 2d 63  es the full 52-c
04e0: 68 61 72 61 63 74 65 72 20 66 69 6c 65 6e 61 6d  haracter filenam
04f0: 65 73 20 69 6e 74 65 72 6e 61 6c 6c 79 2e 0a 42  es internally..B
0500: 75 74 20 66 6f 72 20 68 75 6d 61 6e 20 69 6e 74  ut for human int
0510: 65 72 61 63 74 69 6f 6e 2c 20 66 69 6c 65 6e 61  eraction, filena
0520: 6d 65 73 0a 61 72 65 20 6d 61 79 20 62 65 20 61  mes.are may be a
0530: 62 62 72 65 76 69 61 74 65 64 20 74 6f 20 61 20  bbreviated to a 
0540: 75 6e 69 71 75 65 20 70 72 65 66 69 78 2e 0a 49  unique prefix..I
0550: 6e 20 70 72 61 63 74 69 63 65 2c 20 34 20 6f 72  n practice, 4 or
0560: 20 35 0a 63 68 61 72 61 63 74 65 72 73 20 61 72   5.characters ar
0570: 65 20 75 73 75 61 6c 6c 79 20 73 75 66 66 69 63  e usually suffic
0580: 69 65 6e 74 20 74 6f 20 67 69 76 65 20 61 20 75  ient to give a u
0590: 6e 69 71 75 65 20 0a 6e 61 6d 65 20 70 72 65 66  nique .name pref
05a0: 69 78 20 74 6f 20 66 69 6c 65 73 20 65 76 65 6e  ix to files even
05b0: 20 69 6e 20 74 68 65 20 6c 61 72 67 65 73 74 20   in the largest 
05c0: 6f 66 20 70 72 6f 6a 65 63 74 73 2e 0a 53 6f 20  of projects..So 
05d0: 77 65 20 63 61 6e 20 72 65 66 65 72 20 74 6f 20  we can refer to 
05e0: 74 68 65 20 63 75 72 72 65 6e 74 20 76 65 72 73  the current vers
05f0: 69 6f 6e 20 6f 66 20 66 6f 73 73 69 6c 20 61 73  ion of fossil as
0600: 20 6a 75 73 74 3a 3c 2f 70 3e 0a 0a 3c 62 6c 6f   just:</p>..<blo
0610: 63 6b 71 75 6f 74 65 3e 3c 62 3e 0a 20 20 20 20  ckquote><b>.    
0620: 77 6a 35 6e 6d 0a 3c 2f 62 3e 3c 2f 62 6c 6f 63  wj5nm.</b></bloc
0630: 6b 71 75 6f 74 65 3e 0a 0a 3c 2f 62 6f 64 79 3e  kquote>..</body>
0640: 0a 3c 2f 68 74 6d 6c 3e 0a                       .</html>.