加密数据中的空字符 [英] Null character in encrypted data

查看:86
本文介绍了加密数据中的空字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在进行cbc加密后,字符是否有可能出现在所得的多字节数据中.如果是,我应该采取什么预防措施来避免这种情况.

Is it possible that after cbc encryption, null character appears in the resulting multibyte data. If yes, what precaution should I take to avoid it.

推荐答案

在进行cbc加密之后,是否有空字符出现在生成的多字节数据中.

Is it possible that after cbc encryption, null character appears in the resulting multibyte data.

绝对.如果缺少0之类的值,它将不是伪随机函数.

Absolutely. It would not be a pseudo-random function if values like 0's were missing.

如果是,我应该采取什么预防措施来避免这种情况.

If yes, what precaution should I take to avoid it.

将所有内容作为带有嵌入式NULLbyte数组进行处理.切勿将其视为char*.

Treat everything as a byte array with embedded NULLs. Never treat it like a char*.

如果要将其视为char*,则需要先对其进行编码.尝试使用十六进制,Base32或Base64.

If you want to treat it like a char*, then you will need to encode it first. Try hexadecimal, Base32 or Base64.

这篇关于加密数据中的空字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆