小编mos*_*ate的帖子

加密(AES)

我使用AES算法来加密我的数据.当我加密16字节(一个块)时,结果是32字节.我期望16字节,但它生成32字节.如果我以字符串格式使用我的代码,结果是相同的.为什么?

我的源代码是

package chert.chert;

import chert.chert.R;
import chert.chert.SimpleCrypto;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class ChertActivity extends Activity {
    /** Called when the activity is first created. */
    TextView textView1;



    byte[] key=new byte[16];
    byte[] state=new byte[16];
    public SimpleCrypto Crypt = new SimpleCrypto(this);

    @Override
    public void onCreate(Bundle savedInstanceState) {
        int i;
        String ss,state_str,key_str;
        char c;
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);




        //======================================================================================================================        

        state[0]=0x32;           state[1]=(byte) 0x88;  state[2]=0x31;          state[3]=(byte) 0xe0;
        state[4]=0x43;           state[5]=0x5a;         state[6]=0x31;          state[7]=0x37;
        state[8]=(byte) 0xf6;    state[9]=0x30;         state[10]=(byte) 0x98;  state[11]=0x07;
        state[12]=(byte) 0xa8;   state[13]=(byte) 0x8d; state[14]=(byte) 0xa2; …
Run Code Online (Sandbox Code Playgroud)

security android cryptography aes

3
推荐指数
1
解决办法
1996
查看次数

标签 统计

aes ×1

android ×1

cryptography ×1

security ×1