code: public static URI createSha1Urn(final ByteBuffer buf) throws IOException
          {
          final MessageDigest md = new Sha1();
          md.update(buf);
  
          final byte[] sha1 = md.digest();
  
          try
              {
              // preferred casing: lowercase "urn:sha1:", uppercase encoded value
              // note that all URNs are case-insensitive for the "urn:<type>:" part,
              // but some MAY be case-sensitive thereafter (SHA1/Base32 is case 
              // insensitive)
              return new URI("urn:sha1:"+Base32.encode(sha1));
              }
          catch (final URISyntaxException e)
              {
              // This should never happen.
              LOG.error("Could not encode SHA-1", e);
              throw new IOException("bad uri: "+Base32.encode(sha1));
              }  
          }
docs: Create a new SHA1 hash URI for the specified {@link ByteBuffer}.
  
  @param buf The {@link ByteBuffer} to create the SHA-1 for.
  @return The SHA1 hash as a URI.
  @throws IOException If there is an error creating the hash or if the
  specified algorithm cannot be found.