public void update(byte[] buf, int index, int len){

    if(len==1){
      s1+=buf[index++]&0xff; s2+=s1;
      s1%=BASE;
      s2%=BASE;
      return;
    }

    int len1 = len/NMAX;
    int len2 = len%NMAX;
    while(len1-->0) {
      int k=NMAX;
      len-=k;
      while(k-->0){
	s1+=buf[index++]&0xff; s2+=s1;
      }
      s1%=BASE;
      s2%=BASE;
    }

    int k=len2;
    len-=k;
    while(k-->0){
      s1+=buf[index++]&0xff; s2+=s1;
    }
    s1%=BASE;
    s2%=BASE;
  }