We were given a project to implement the RC5 encryption algorithm in java. I've been stuck for hours now on just getting the 128 key in string format and transferring it into a byte array I can work with to preform bit-wise operations, as required by the algorithm. First I tried to just turn the string to a binary number:

Long hexNum = Long.parseLong(keyString, 16); System.out.println(Long.toBinaryString(hexNum));

but then remembered that the string represents a 128 bits unsigned integer (can be even longer), so the Long variable doesn't really help.

I know it seems like I haven't done much, but I've been sitting on this for hours and haven't made any progress (maybe I didn't get the idea of the algorithm?), so if any of you can help, please do.

Thanks!