User enter code word and text to encrypt and program should put XOR mask - code on text - and turn back to normal , but it just put on mask and dont turn back to normal look , why ?
public void onClick(View arg0) {
code = etCode.getText().toString();
text = etText.getText().toString();
while(code.length()<text.length()){
code+=code;
}
char[] Ccode = code.toCharArray();
char[] Ctext = text.toCharArray();
for(i=0;i<Ctext.length;i++){
Ctext[i]^=Ccode[i];
}
rezult=Ctext.toString();
for(i=0;i<Ctext.length;i++){
Ctext[i]^=Ccode[i];
}
rezult+="\n";
rezult+=Ctext.toString();
tvMain.setText(rezult);
}
});
if I enter code : code , text : text
it shows:
[C@40527808
[C@40527808
You output the address of the array. You want the content.
Arrays have not useful toString() mwthod.
change
rezult=Ctext.toString();
to
rezult=new String(Ctext);
same for
rezult+=Ctext.toString();
=>
rezult+=new String(Ctext);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With