code: private static byte[] oneBlock(byte[] buffer, InputStream in, int len) throws IOException {
          MessageDigest sha1 = null;
          try {
              sha1 = MessageDigest.getInstance("sha-1");
          } catch (NoSuchAlgorithmException e) {
              e.printStackTrace();
              //never reach
              return null;
          }
          int buffSize = buffer.length;
          while (len != 0) {
              int next = buffSize > len ? len : buffSize;
              //noinspection ResultOfMethodCallIgnored
              in.read(buffer, 0, next);
              sha1.update(buffer, 0, next);
              len -= next;
          }
  
          return sha1.digest();
      }
docs: 单块计算hash
  
  @param buffer 数据缓冲区
  @param in     输入数据
  @param len    输入数据长度
  @return 计算结果
  @throws IOException 读取出错