<html>
<head>
<title>Fossil - Base-32 Name Encoding</title>
</head>
<body bgcolor="white">
<h1>Base-32 Name Encoding</h1>

<p>The name of a file or version in fossil is the
<a href="http://en.wikipedia.org/wiki/SHA-1">SHA-256</a> hash of
the content of that file or version expressed in a base-32 
encoding.  The digits of the base-32 encode are as 
follows:

<blockquote><b>
    0123456789abcdefghjkmnpqrstuvwxy
</b></blockquote>

<p>The letters "o", "i", and "l" are omitted from the
encoding character set to avoid confusion with the 
digits "0" and "1".  On input, upper and lower case 
letters are treated the same, the letter "o" is 
interpreted as a zero ("0") and the letters "i" and 
"l" are interpreted as a one ("1").</p>

<p>
Each character of the base-32 encoding represents 5 bits
of the hash.  The first four bits of the SHA256 hash are
repeated onto the end of the hash to make the hash a multiple
of 5 bits in length.  In this way, the final digit in the
52-digit base-32 number represents a full 5 bits.
</p>

<p>As an example, the name of the current head version in
fossil's self-hosting repository is:</p>

<blockquote><b>
    wj5nmfgr2u62pnkd35a93h7481w2utdkgs2mptf8gyy6qswf1v47
</b></blockquote>

<p>Fossil uses the full 52-character filenames internally.
But for human interaction, filenames
are may be abbreviated to a unique prefix.
In practice, 4 or 5
characters are usually sufficient to give a unique 
name prefix to files even in the largest of projects.
So we can refer to the current version of fossil as just:</p>

<blockquote><b>
    wj5nm
</b></blockquote>

</body>
</html>
