• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

java的AES加密:

导入javax。密码。密码;

导入javax。密码。规格。ivparameterspec

导入javax。密码。规格。secretkeyspec

导入Java。安全。消息摘要;

导入Java。util。数组;

公共类你好

公共静态void main(String[] args) {

字符串名称='哈喽啊;

//设置俄歇电子能谱加密的键和输入阀交互式视讯自变量(独立变量)

string key=' fehg 123 hjj 216 jjwqhe 16 I 32 kj 1 nkn 22 ';//键必需是32位

string iv=' 77b 07a 672d 57d 643 ';//四必须是16位

//加密

byte[]raw=key。getbytes();

SecretKeySpec secretKey=new SecretKeySpec(raw,' AES ');

IvParameterSpec iv spec=new IvParameterSpec(iv。getbytes());

尝试{

密码密码=密码。getinstance(' AES/CBC/pkcs 5 padding ');

密码.初始化(密码. DECRYPT_MODE,secretKey,iv spec);

byte[]encrypted=密码。做最后(名。getbytes());

系统。出去。println(数组。tostring(加密));

}catch(异常e){

系统。出去。println(e);

}

}

}

python的AEC加密:

来自密码.密码导入俄歇电子能谱

来自密码.填充导入填充

KEY=' fehg 123 hjj 216 jjwqhe 16 I 32 kj 1 nknw '

IV='77b07a672d57d64c '

定义aes_encrypt(数据_字符串):

aes=AES.new(

key=KEY.encode('utf-8 '),

模式=AES .MODE_CBC,

iv=IV.encode('utf-8 '),

)

raw=pad(data _ string。编码(' utf-8 '),16)

返回高级加密标准(原始)

data=aes_encrypt('哈喽啊)

#将字节类型转成到16进制表示

c=data.hex()

打印(三)#打印结果:f 30 a 976 c 22 f 42 DBD 7d 6 BF 26 Fe 2c 84 cc 9

打印(数据)#打印结果(字节类型):b ' \ xf3 \ n \ x97l ' \ xf4-\ xbd } k \ xf2o \ xe2 \ xc8L \ xc9 '

打印([i for i in data]) #打印结果(每个字节的美国信息交换标准代码码):[243, 10, 151, 108, 34, 244, 45, 189, 125, 107, 242, 111, 226, 200, 76, 201]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now