calculate the buffer size based on hash size