static KuzIntKey convertKey(byte[] key) {
        if (key.length != 32) {
            throw new RuntimeException("Key might be 32 bytes length");
        }

        KuzIntKey kuz = new KuzIntKey();
        // w128_t c, x, y, z;
        Kuz128 c = new Kuz128(), x = new Kuz128(), y = new Kuz128(), z = new Kuz128();

        for (int i = 0; i < 16; i++) {
            // this will be have to changed for little-endian systems
            // x.b[i] = key[i];
            // y.b[i] = key[i + 16];
            x.getB()[i] = key[i];
            y.getB()[i] = key[i + 16];
        }

        // kuz->k[0].q[0] = x.q[0];
        // kuz->k[0].q[1] = x.q[1];
        // kuz->k[1].q[0] = y.q[0];
        // kuz->k[1].q[1] = y.q[1];
        kuz.getK()[0].set(x);
        kuz.getK()[1].set(y);

        for (int i = 1; i <= 32; i++) {
            // C Value
            // c.q[0] = 0;
            // c.q[1] = 0;
            // c.b[15] = i;		// load round in lsb
            // kuz_l(&c);
            c.setQ(0, 0);
            c.setQ(1, 0);
            c.getB()[15] = (byte) i;

            KuznechikMath.kuz_l(c);

            // z.q[0] = x.q[0] ^ c.q[0];
            // z.q[1] = x.q[1] ^ c.q[1];
            // for (j = 0; j < 16; j++)
            //   z.b[j] = kuz_pi[z.b[j]];
            // kuz_l(&z);
            z.setQ(0, x.getQ(0) ^ c.getQ(0));
            z.setQ(1, x.getQ(1) ^ c.getQ(1));

            for (int j = 0; j < 16; j++) {
                z.getB()[j] = KuznechikTables.kuz_pi[(z.getB()[j] & 0xFF)];
            }

            KuznechikMath.kuz_l(z);

            // z.q[0] ^= y.q[0];
            // z.q[1] ^= y.q[1];
            z.setQ(0, z.getQ(0) ^ y.getQ(0));
            z.setQ(1, z.getQ(1) ^ y.getQ(1));

            // y.q[0] = x.q[0];
            // y.q[1] = x.q[1];
            y.set(x);

            // x.q[0] = z.q[0];
            // x.q[1] = z.q[1];
            x.set(z);

            // if ((i & 7) == 0) {
            //    kuz->k[(i >> 2)].q[0] = x.q[0];
            //    kuz->k[(i >> 2)].q[1] = x.q[1];
            //    kuz->k[(i >> 2) + 1].q[0] = y.q[0];
            //    kuz->k[(i >> 2) + 1].q[1] = y.q[1];
            // }
            if ((i & 7) == 0) {
                kuz.getK()[(i >> 2)].set(x);
                kuz.getK()[(i >> 2) + 1].set(y);
            }
        }

        return kuz;
    }
static KuzIntKey convertKey ( byte [ ] key ) { if ( key . length != 32 ) { throw new RuntimeException ( "Key might be 32 bytes length" ) ; } KuzIntKey kuz = new KuzIntKey ( ) ; Kuz128 c = new Kuz128 ( ) , x = new Kuz128 ( ) , y = new Kuz128 ( ) , z = new Kuz128 ( ) ; for ( int i = 0 ; i < 16 ; i ++ ) { x . getB ( ) [ i ] = key [ i ] ; y . getB ( ) [ i ] = key [ i + 16 ] ; } kuz . getK ( ) [ 0 ] . set ( x ) ; kuz . getK ( ) [ 1 ] . set ( y ) ; for ( int i = 1 ; i <= 32 ; i ++ ) { c . setQ ( 0 , 0 ) ; c . setQ ( 1 , 0 ) ; c . getB ( ) [ 15 ] = ( byte ) i ; KuznechikMath . kuz_l ( c ) ; z . setQ ( 0 , x . getQ ( 0 ) ^ c . getQ ( 0 ) ) ; z . setQ ( 1 , x . getQ ( 1 ) ^ c . getQ ( 1 ) ) ; for ( int j = 0 ; j < 16 ; j ++ ) { z . getB ( ) [ j ] = KuznechikTables . kuz_pi [ ( z . getB ( ) [ j ] & 0xFF ) ] ; } KuznechikMath . kuz_l ( z ) ; z . setQ ( 0 , z . getQ ( 0 ) ^ y . getQ ( 0 ) ) ; z . setQ ( 1 , z . getQ ( 1 ) ^ y . getQ ( 1 ) ) ; y . set ( x ) ; x . set ( z ) ; if ( ( i & 7 ) == 0 ) { kuz . getK ( ) [ ( i > > 2 ) ] . set ( x ) ; kuz . getK ( ) [ ( i > > 2 ) + 1 ] . set ( y ) ; } } return kuz ; }
Converting binary representation of a key to internal format

@param key raw key
@return key in internal format