public static void skip32 ( byte [ ] key , int [ ] buf , boolean encrypt ) { int k ; /* round number */ int i ; /* round counter */ int kstep ; int wl , wr ; /* sort out direction */ if ( encrypt ) { kstep = 1 ; k = 0 ; } else { kstep = - 1 ; k = 23 ; } /* pack into words */ wl = ( buf [ 0 ] << 8 ) + buf [ 1 ] ; wr = ( buf [ 2 ] << 8 ) + buf [ 3 ] ; /* 24 feistel rounds, doubled up */ for ( i = 0 ; i < 24 / 2 ; ++ i ) { wr ^= g ( key , k , wl ) ^ k ; k += kstep ; wl ^= g ( key , k , wr ) ^ k ; k += kstep ; } /* implicitly swap halves while unpacking */ buf [ 0 ] = ( wr >> 8 ) ; buf [ 1 ] = ( wr & 0xFF ) ; buf [ 2 ] = ( wl >> 8 ) ; buf [ 3 ] = ( wl & 0xFF ) ; }
Applies the SKIP32 function on the provided value stored in buf and modifies it inplace . This is a low - level function used by the encrypt and decrypt functions .