Example #1
0
  public void crypt(byte[] raw, final int offset, final int size) throws IOException {
    int count = size / 8;
    byte[] result = new byte[size];

    for (int i = 0; i < count; i++) {
      _crypt.processBlock(raw, offset + i * 8, result, i * 8);
    }
    // TODO can the crypt and decrypt go direct to the array
    System.arraycopy(result, 0, raw, offset, size);
  }
Example #2
0
  public byte[] crypt(byte[] raw) throws IOException {
    int count = raw.length / 8;
    byte[] result = new byte[raw.length];

    for (int i = 0; i < count; i++) {
      _crypt.processBlock(raw, i * 8, result, i * 8);
    }

    return result;
  }
Example #3
0
 /** @param blowfishKey */
 public NewCrypt(byte[] blowfishKey) {
   _crypt = new BlowfishEngine();
   _crypt.init(true, blowfishKey);
   _decrypt = new BlowfishEngine();
   _decrypt.init(false, blowfishKey);
 }