buffer[setLength] = (byte)keyType;
int keyLength = key.write(buffer, setLength + 1);
// Run additional 16% faster using direct class versus
// HashFactory.getInstance("RIPEMD-160").
RipeMD160 hash = new RipeMD160();
hash.update(buffer, 0, setLength);
hash.update(buffer, setLength, keyLength + 1);
return hash.digest();
}