public final void des_set_key(byte[] key, int[] schedule)
		throws SecurityException
	{
		int c,d,t,s;
		int inIndex;
		int kIndex;
		int i;

		if (des_check_key) {
			if (!check_parity(key)) {
    			throw new SecurityException("des_set_key attempted with incorrect parity");
			}

    		if (des_is_weak_key(key)) {
    			throw new SecurityException("des_set_key attempted with weak key");
    		}
		}

		inIndex=0;
		kIndex=0;

		c =Get32bits(key, inIndex);
		d =Get32bits(key, inIndex+4);

		t=(((d>>>4)^c)&0x0f0f0f0f);
		c^=t;
		d^=(t<<4);

		t=(((c<<(16-(-2)))^c)&0xcccc0000);
		c=c^t^(t>>>(16-(-2)));

		t=((d<<(16-(-2)))^d)&0xcccc0000;
		d=d^t^(t>>>(16-(-2)));

		t=((d>>>1)^c)&0x55555555;
		c^=t;
		d^=(t<<1);

		t=((c>>>8)^d)&0x00ff00ff;
		d^=t;
		c^=(t<<8);

		t=((d>>>1)^c)&0x55555555;
		c^=t;
		d^=(t<<1);

		d=	(((d&0x000000ff)<<16)| (d&0x0000ff00) |((d&0x00ff0000)>>>16)|((c&0xf0000000)>>>4));
		c&=0x0fffffff;

		for (i=0; i < 16; i++) {
			if (shifts2[i]) {
				c=((c>>>2)|(c<<26));
				d=((d>>>2)|(d<<26));
			} else {
				c=((c>>>1)|(c<<27));
				d=((d>>>1)|(d<<27));
			}

			c&=0x0fffffff;
			d&=0x0fffffff;

			s=	des_skb[0][ (c    )&0x3f                ]|
				des_skb[1][((c>>> 6)&0x03)|((c>>> 7)&0x3c)]|
				des_skb[2][((c>>>13)&0x0f)|((c>>>14)&0x30)]|
				des_skb[3][((c>>>20)&0x01)|((c>>>21)&0x06) |
						  ((c>>>22)&0x38)];
			t=	des_skb[4][ (d    )&0x3f                ]|
				des_skb[5][((d>>> 7)&0x03)|((d>>> 8)&0x3c)]|
				des_skb[6][ (d>>>15)&0x3f                ]|
				des_skb[7][((d>>>21)&0x0f)|((d>>>22)&0x30)];

			schedule[kIndex++]=((t<<16)|(s&0x0000ffff))&0xffffffff;

			s=((s>>>16)|(t&0xffff0000));

			s=(s<<4)|(s>>>28);

			schedule[kIndex++]=s&0xffffffff;
		}
	}