@Override public void map(Text key, Text value, Context context) throws IOException, InterruptedException { byte[] randomIV = crypto.randomBytes(AES_BLOCK_SIZE); byte[] pt = new byte[KEY_LENGTH + VALUE_LENGTH]; System.arraycopy(key.copyBytes(), 0, pt, 0, KEY_LENGTH); System.arraycopy(value.copyBytes(), 0, pt, KEY_LENGTH, VALUE_LENGTH); // byte[] ct = crypto.encrypt_word_rnd(value.toString(), randomIV); byte[] ct = crypto.encrypt_word_cbc(pt, randomIV); System.out.println("ct size = " + ct.length); context.write(new BytesWritable(randomIV), new BytesWritable(ct)); }