Example usage for java.util BitSet xor

List of usage examples for java.util BitSet xor

Introduction

In this page you can find the example usage for java.util BitSet xor.

Prototype

public void xor(BitSet set) 

Source Link

Document

Performs a logical XOR of this bit set with the bit set argument.

Usage

From source file:uk.co.infinityapps.rehpic.round.RoundFunctionImpl.java

public byte[] decrypt(byte[] blockData, final byte[][] subKeys) {
    final byte[][] reversedSubKeys = reverseSubKeysForDecryption(subKeys);

    for (byte[] subKey : reversedSubKeys) {
        blockData = substitutionBox.subtitute(blockData, subKey);
        BitSet xorBlockBitSet = BitSet.valueOf(blockData);
        xorBlockBitSet.xor(BitSet.valueOf(subKey));
        blockData = permutator.shiftRight(BitUtils.bitSetToByteArray(xorBlockBitSet, blockData.length), subKey);
        blockData = mixingPermutator.unmix(blockData);
    }//from   w w  w  . j av  a  2 s. c o  m
    return blockData;
}