public byte[] crypt(final byte[] msg) {
		final ReadLock readLock = this.lock.readLock();
		readLock.lock();
		byte[] code;
		try {
			final int[] sbox = this.sbox.clone();
			code = new byte[msg.length];
			int i = 0;
			int j = 0;
			for (int n = 0; n < msg.length; n++) {
				i = (i + 1) % SBOX_LENGTH;
				j = (j + sbox[i]) % SBOX_LENGTH;
				swap(i, j, sbox);
				int rand = sbox[(sbox[i] + sbox[j]) % SBOX_LENGTH];
				code[n] = (byte) (rand ^ msg[n]);
			}
		} finally {
			readLock.unlock();
		}
		return code;
	}
public byte [ ] crypt ( final byte [ ] msg ) { final ReadLock readLock = this . lock . readLock ( ) ; readLock . lock ( ) ; byte [ ] code ; try { final int [ ] sbox = this . sbox . clone ( ) ; code = new byte [ msg . length ] ; int i = 0 ; int j = 0 ; for ( int n = 0 ; n < msg . length ; n ++ ) { i = ( i + 1 ) % SBOX_LENGTH ; j = ( j + sbox [ i ] ) % SBOX_LENGTH ; swap ( i , j , sbox ) ; int rand = sbox [ ( sbox [ i ] + sbox [ j ] ) % SBOX_LENGTH ] ; code [ n ] = ( byte ) ( rand ^ msg [ n ] ) ; } } finally { readLock . unlock ( ) ; } return code ; }
加密或解密指定值，调用此方法前需初始化密钥

@param msg 要加密或解密的消息
@return 加密或解密后的值