• 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的gzip加密:

导入Java。io。bytearray inputstream

导入Java。io。bytearrayoutputstream

导入Java。util。数组;

导入Java。util。拉链。gzipinputstream

导入Java。util。拉链。gzipoutputstream

公共类你好

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

尝试{

字符串数据='哈喽啊;

//gzip压缩

ByteArrayOutputStream v 0 _ 1=new ByteArrayOutputStream();

GZIPOutputStream v1=new GZIPOutputStream(v 0 _ 1);

v1。写(数据。getbytes());

v1。close();

byte[]arg 6=v 0 _ 1。tobytearray();

系统。出去。println(数组。tostring(arg 6));//打印结果:[31, -117, 8, 0, 0, 0, 0, 0, 0, 0, 123, 58, -71, -29, -23, -76, -67, 79, -89, 118, 1, 0, 97, 15, -5, -43, 9, 0, 0, 0]

//gzip解压缩

ByteArrayOutputStream out=new ByteArrayOutputStream();

bytearray inputstream in=new bytearray inputstream(arg 6);

GZIPInputStream ungzip=new GZIPInputStream(in);

字节[]缓冲区=新字节[256];

int n;

while((n=ung zip。read(buffer))=0){

out.write(buffer,0,n);

}

byte[]RES=out。tobytearray();

系统。出去。println(数组。tostring(RES));//打印结果:[-27, -109, -120, -27, -106, -67, -27, -107, -118]

系统。出去。println(out。tostring(' utf-8 ');//打印结果:哈喽啊

}catch(异常e){

系统。出去。println(e);

}

}

}

python的gzip加密:

导入压缩

#压缩

data_in='哈喽啊。编码(“utf-8”)

data_out=gzip.compress(data_in)

print(data_out)#打印结果:b ' \ x1f \ x8b \ x08 \ x00 \ x98 wmb \ x02 \ xff { : \ xb9 \ xe3 \ xe9 \ xb4 \ xbdO \ xa7v \ x01 \ x00a \ x0f \ xfb \ xd5 \ t \ x00 \ x00 \ x00 '

print(data_out.hex()) #打印16进制的加密数据:1 f8b 0800 b 9776d 6202 ff 7 B3 ab 9 e 9 B4 BD 4 fa 7760100610 ffbd 509000000

#解压缩

res=gzip.decompress(data_out)

打印(分辨率)#打印解压缩后的utf-8编码:b ' \ xe5 \ x93 \ x88 \ xe5 \ x96 \ xbd \ xe5 \ x95 \ x8a '

打印(分辨率解码(' utf-8 '))将utf-8的编码,解码成字符串:哈喽啊

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