I need to create a Rc2Key variable and then convert this to hexadecimal. I have done this with two commands. The Rc2Key variable has to be 16 characters long, so in my test module I used "DummyRC2Key1" as the Rc2Key.


HexRc2Key=$(printf "${Rc2Key}" | xxd -p)

With that done I need to pad the CTF keys with eight 0s. I did this with the following commands and output this padded list to CTFpadlist.csv


while read CTFlist; do echo $CTFlist$zeros; done < CTFlist.csv > CTFpadlist.csv

With the padded CTF's and the HexRc2Key, I need to encrypt the CTFpadlist.csv

while read CTFpadlist; do echo -n "$CTFpadlist" | xxd -r -p | openssl enc -rc2-cbc -nopad -K "${HexRc2Key}" -iv 0000000000000000 | xxd -plain | tr d '/n'; done < CTFpadlist.csv > EncCTFlist.csv

Here is the problem—my hex comes out with "/" like so:


This is not an acceptable hex. What am I doing wrong here?


Rather than

tr d '/n'; 

you probably meant

tr -d '\n'; 
  • Thank you sirby you pointing out the improper placement i located the problem. just by deleting the '/n' fixed the problem. Thank you – DJLee Apr 25 '16 at 21:14
  • how do i accept it? i clicked the up arrow – DJLee Apr 25 '16 at 21:17
  • nevermind...duhh – DJLee Apr 25 '16 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.