public void initSign(byte[] seed0,byte[] message){
  this.hash=new byte[mdsize];
  messDigestOTS.update(message,0,message.length);
  this.hash=new byte[messDigestOTS.getDigestSize()];
  messDigestOTS.doFinal(this.hash,0);
  byte[] messPart=new byte[mdsize];
  System.arraycopy(hash,0,messPart,0,mdsize);
  int checkPart=0;
  int sumH=0;
  int checksumsize=getLog((messagesize << w) + 1);
  if (8 % w == 0) {
    int dt=8 / w;
    for (int a=0; a < mdsize; a++) {
      for (int b=0; b < dt; b++) {
        sumH+=messPart[a] & k;
        messPart[a]=(byte)(messPart[a] >>> w);
      }
    }
    this.checksum=(messagesize << w) - sumH;
    checkPart=checksum;
    for (int b=0; b < checksumsize; b+=w) {
      sumH+=checkPart & k;
      checkPart>>>=w;
    }
  }
 else   if (w < 8) {
    long big8;
    int ii=0;
    int dt=mdsize / w;
    for (int i=0; i < dt; i++) {
      big8=0;
      for (int j=0; j < w; j++) {
        big8^=(messPart[ii] & 0xff) << (j << 3);
        ii++;
      }
      for (int j=0; j < 8; j++) {
        sumH+=(int)(big8 & k);
        big8>>>=w;
      }
    }
    dt=mdsize % w;
    big8=0;
    for (int j=0; j < dt; j++) {
      big8^=(messPart[ii] & 0xff) << (j << 3);
      ii++;
    }
    dt<<=3;
    for (int j=0; j < dt; j+=w) {
      sumH+=(int)(big8 & k);
      big8>>>=w;
    }
    this.checksum=(messagesize << w) - sumH;
    checkPart=checksum;
    for (int i=0; i < checksumsize; i+=w) {
      sumH+=checkPart & k;
      checkPart>>>=w;
    }
  }
 else   if (w < 57) {
    long big8;
    int r=0;
    int s, f, rest, ii;
    while (r <= ((mdsize << 3) - w)) {
      s=r >>> 3;
      rest=r % 8;
      r+=w;
      f=(r + 7) >>> 3;
      big8=0;
      ii=0;
      for (int j=s; j < f; j++) {
        big8^=(messPart[j] & 0xff) << (ii << 3);
        ii++;
      }
      big8>>>=rest;
      sumH+=(big8 & k);
    }
    s=r >>> 3;
    if (s < mdsize) {
      rest=r % 8;
      big8=0;
      ii=0;
      for (int j=s; j < mdsize; j++) {
        big8^=(messPart[j] & 0xff) << (ii << 3);
        ii++;
      }
      big8>>>=rest;
      sumH+=(big8 & k);
    }
    this.checksum=(messagesize << w) - sumH;
    checkPart=checksum;
    for (int i=0; i < checksumsize; i+=w) {
      sumH+=(checkPart & k);
      checkPart>>>=w;
    }
  }
  this.keysize=messagesize + (int)Math.ceil((double)checksumsize / (double)w);
  this.steps=(int)Math.ceil((double)(keysize + sumH) / (double)((1 << height)));
  this.sign=new byte[keysize * mdsize];
  this.counter=0;
  this.test=0;
  this.ii=0;
  this.test8=0;
  this.r=0;
  this.privateKeyOTS=new byte[mdsize];
  this.seed=new byte[mdsize];
  System.arraycopy(seed0,0,this.seed,0,mdsize);
}

public void initSign ( byte [ ] seed0 , byte [ ] message ) { this . hash = new byte [ mdsize ] ; messDigestOTS . update ( message , 0 , message . length ) ; this . hash = new byte [ messDigestOTS . getDigestSize ( ) ] ; messDigestOTS . doFinal ( this . hash , 0 ) ; byte [ ] messPart = new byte [ mdsize ] ; System . arraycopy ( hash , 0 , messPart , 0 , mdsize ) ; int checkPart = 0 ; int sumH = 0 ; int checksumsize = getLog ( ( messagesize << w ) + 1 ) ; if ( 8 % w == 0 ) { int dt = 8 / w ; for ( int a = 0 ; a < mdsize ; a ++ ) { for ( int b = 0 ; b < dt ; b ++ ) { sumH += messPart [ a ] & k ; messPart [ a ] = ( byte ) ( messPart [ a ] > > > w ) ; } } this . checksum = ( messagesize << w ) - sumH ; checkPart = checksum ; for ( int b = 0 ; b < checksumsize ; b += w ) { sumH += checkPart & k ; checkPart >>>= w ; } } else if ( w < 8 ) { long big8 ; int ii = 0 ; int dt = mdsize / w ; for ( int i = 0 ; i < dt ; i ++ ) { big8 = 0 ; for ( int j = 0 ; j < w ; j ++ ) { big8 ^= ( messPart [ ii ] & 0xff ) << ( j << 3 ) ; ii ++ ; } for ( int j = 0 ; j < 8 ; j ++ ) { sumH += ( int ) ( big8 & k ) ; big8 >>>= w ; } } dt = mdsize % w ; big8 = 0 ; for ( int j = 0 ; j < dt ; j ++ ) { big8 ^= ( messPart [ ii ] & 0xff ) << ( j << 3 ) ; ii ++ ; } dt <<= 3 ; for ( int j = 0 ; j < dt ; j += w ) { sumH += ( int ) ( big8 & k ) ; big8 >>>= w ; } this . checksum = ( messagesize << w ) - sumH ; checkPart = checksum ; for ( int i = 0 ; i < checksumsize ; i += w ) { sumH += checkPart & k ; checkPart >>>= w ; } } else if ( w < 57 ) { long big8 ; int r = 0 ; int s , f , rest , ii ; while ( r <= ( ( mdsize << 3 ) - w ) ) { s = r > > > 3 ; rest = r % 8 ; r += w ; f = ( r + 7 ) > > > 3 ; big8 = 0 ; ii = 0 ; for ( int j = s ; j < f ; j ++ ) { big8 ^= ( messPart [ j ] & 0xff ) << ( ii << 3 ) ; ii ++ ; } big8 >>>= rest ; sumH += ( big8 & k ) ; } s = r > > > 3 ; if ( s < mdsize ) { rest = r % 8 ; big8 = 0 ; ii = 0 ; for ( int j = s ; j < mdsize ; j ++ ) { big8 ^= ( messPart [ j ] & 0xff ) << ( ii << 3 ) ; ii ++ ; } big8 >>>= rest ; sumH += ( big8 & k ) ; } this . checksum = ( messagesize << w ) - sumH ; checkPart = checksum ; for ( int i = 0 ; i < checksumsize ; i += w ) { sumH += ( checkPart & k ) ; checkPart >>>= w ; } } this . keysize = messagesize + ( int ) Math . ceil ( ( double ) checksumsize / ( double ) w ) ; this . steps = ( int ) Math . ceil ( ( double ) ( keysize + sumH ) / ( double ) ( ( 1 << height ) ) ) ; this . sign = new byte [ keysize * mdsize ] ; this . counter = 0 ; this . test = 0 ; this . ii = 0 ; this . test8 = 0 ; this . r = 0 ; this . privateKeyOTS = new byte [ mdsize ] ; this . seed = new byte [ mdsize ] ; System . arraycopy ( seed0 , 0 , this . seed , 0 , mdsize ) ; }
this method initializes the distributed sigature calculation . variables are reseted and necessary steps are calculated
