I wouldn't bother with the temporary sha1 variable here.  Also, b.length() is not the same size as the number of bytes available for hashing.  If the name contains a multi-byte character for example, with UTF-8 encoding we won't consider everything in the hash.