id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

orion.a.smith@gmail.com apcsa-encryption > apcsaDecryptXor
prev  |  next  |  chance

Given an input ciphertext ArrayList of Integer values and a secret key String, use the bitwise xor operation (this is the symbol ^) to go through all the numbers in the input and produce a plaintext output. Reconstruct the output as a String. So the element at index 0 of the output is the result of an exclusive or between the element at index 0 of the input and the element at index 0 of the key. Once the last index of the key is used, wrap back around to use the beginning of the key.

HINT
Given two char variables a and b, a ^ b should be the exclusive or of the two.

apcsaDecryptXor([17, 3, 16, 23, 18, 9, 21, 12, 25, 11, 24, 31, 26, 1, 29, 20, 1, 19, 0, 7, 2, 25, 5, 28, 9, 27], "PASSWORD") → "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
apcsaDecryptXor([10, 11], "B") → "HI"
apcsaDecryptXor([21, 10, 10, 18, 15, 2, 2, 10, 10, 15, 7, 8, 8, 14, 15, 18, 4, 2, 18, 1, 10, 18, 22, 16], "ABC") → "THISMACHINEKILLSFASCISTS"

...Save, Compile, Run (ctrl-enter)

public String apcsaDecryptXor(ArrayList<Integer> ciphertext, String password) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 350

Copyright Nick Parlante 2017 - privacy