jodd-core/src/main/java/jodd/crypt/Threefish.java
public void blockEncrypt(final long[] p, final long[] c) {
		// initial value = plain
		System.arraycopy(p, 0, vd, 0, nw);

		for (int d = 0; d < nr; d++) { // do the rounds
			// calculate e{d,i}
			if (d % SUBKEY_INTERVAL == 0) {
				final int s = d / SUBKEY_INTERVAL;

				keySchedule(s);

				for (int i = 0; i < nw; i++) {
					ed[i] = vd[i] + ksd[i];
				}
			} else {
				System.arraycopy(vd, 0, ed, 0, nw);
			}

			for (int j = 0; j < nw / 2; j++) {
				x[0] = ed[j * 2];
				x[1] = ed[j * 2 + 1];

				mix(j, d);

				fd[j * 2] = y[0];
				fd[j * 2 + 1] = y[1];
			}

			for (int i = 0; i < nw; i++) {
				vd[i] = fd[pi[i]];
			}

		}

		// do the last keyschedule
		keySchedule(nr / SUBKEY_INTERVAL);

		for (int i = 0; i < nw; i++) {
			c[i] = vd[i] + ksd[i];
		}
	}
public void blockEncrypt(final long[] p, final long[] c) {
		// initial value = plain
		System.arraycopy(p, 0, vd, 0, nw);

		for (int d = 0; d < nr; d++) { // do the rounds
			// calculate e{d,i}
			if (d % SUBKEY_INTERVAL == 0) {
				final int s = d / SUBKEY_INTERVAL;

				keySchedule(s);

				for (int i = 0; i < nw; i++) {
					ed[i] = vd[i] + ksd[i];
				}
			} else {
				System.arraycopy(vd, 0, ed, 0, nw);
			}

			for (int j = 0; j < nw / 2; j++) {
				x[0] = ed[j * 2];
				x[1] = ed[j * 2 + 1];

				mix(j, d);

				fd[j * 2] = y[0];
				fd[j * 2 + 1] = y[1];
			}

			for (int i = 0; i < nw; i++) {
				vd[i] = fd[pi[i]];
			}

		}

		// do the last keyschedule
		keySchedule(nr / SUBKEY_INTERVAL);

		for (int i = 0; i < nw; i++) {
			c[i] = vd[i] + ksd[i];
		}
	}
public void blockEncrypt ( final long [ ] p , final long [ ] c ) { // initial value = plain System . arraycopy ( p , 0 , vd , 0 , nw ) ; for ( int d = 0 ; d < nr ; d ++ ) { // do the rounds // calculate e{d,i} if ( d % SUBKEY_INTERVAL == 0 ) { final int s = d / SUBKEY_INTERVAL ; keySchedule ( s ) ; for ( int i = 0 ; i < nw ; i ++ ) { ed [ i ] = vd [ i ] + ksd [ i ] ; } } else { System . arraycopy ( vd , 0 , ed , 0 , nw ) ; } for ( int j = 0 ; j < nw / 2 ; j ++ ) { x [ 0 ] = ed [ j * 2 ] ; x [ 1 ] = ed [ j * 2 + 1 ] ; mix ( j , d ) ; fd [ j * 2 ] = y [ 0 ] ; fd [ j * 2 + 1 ] = y [ 1 ] ; } for ( int i = 0 ; i < nw ; i ++ ) { vd [ i ] = fd [ pi [ i ] ] ; } } // do the last keyschedule keySchedule ( nr / SUBKEY_INTERVAL ) ; for ( int i = 0 ; i < nw ; i ++ ) { c [ i ] = vd [ i ] + ksd [ i ] ; } }
Implementation of the E(K, T, P) function.
The K and T values should be set previously using the init() method. This version is the 64 bit implementation
of Threefish.

@param p the initial plain text
@param c the final value defined as value v{d} where d = N{r}
Implementation of the E ( K T P ) function . The K and T values should be set previously using the init () method . This version is the 64 bit implementation of Threefish .