【发布时间】:2014-11-10 03:46:47
【问题描述】:
虽然我已使用不同的方法将数据类型更改为字节,但我无法找出为什么“加密”函数仍将“消息”读取为字符串。
错误信息是“Prince 类型中的方法 Encrypt(long, long, long, long, int) 不适用于参数 (String, long, long, long, int)”。
btnSendSMS.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v, String args)
{
String phoneNo = txtPhoneNo.getText().toString();
String message = txtMessage.getText().toString();
if (phoneNo.length()>0 && message.length()>0){
//prince pri = new prince();
//message = toLong();
//byte[] data = message.getBytes("UTF-8");
//LongBuffer messageToLongBuffer;
//String str = message;
//byte[] array = str.getBytes();
String str = message;
byte[] bytes = message.getBytes();
prince.Encrypt (message, k0, kop, k1, t);
//maybe check to decrypt the ciphertext here
//prince.decrypt(message)
//sendSMS explore the sendDataMessage
sendSMS(phoneNo, message); }
else
Toast.makeText(getBaseContext(),
"Please enter both phone number and message.",
Toast.LENGTH_SHORT).show();
}
【问题讨论】:
-
byte[]也不是long。 -
很抱歉,但正如我的讲师告诉我的那样,字节可以读取任意长,所以你是说它不一样? @SLaks
标签: java android type-conversion