为什么我的加密字符串看起来只包含问号? [英] Why does my encrypted string looks like consisting of only question marks?

查看:19
本文介绍了为什么我的加密字符串看起来只包含问号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用 Java 加密一个字符串,当我打印加密数据时,我只看到问号.

I'm encrypting a string in Java, and when I'm printing the encrypted data, I see only question marks.

举个例子:

  • 纯文本:jjkkjlkljkj

加密文本:?????????????

再次解密这段文字后,我又得到了jjkkjlkljkj.

After decrypting this text again, I'm getting jjkkjlkljkj again.

所以看起来加密工作正常.但是为什么我只能看到问号?

So it looks like the encryption worked right. But why can I see only question marks?

推荐答案

是的,这是因为您无法打印由加密产生的字符串.

Yes, it's because you can't print the strings that are resulting from the encryption.

请注意,将加密结果保存在字符串中可能会导致数据丢失,所以不要这样做.将其作为字节数组,并将其转换为可显示格式,例如 Base64 或简单的十六进制.

Note that saving the encrypted result in a string will possibly result in loss of the data, so don't do that. Take it as a byte array, and convert it to a displayable format, like Base64 or just simple Hex.

这篇关于为什么我的加密字符串看起来只包含问号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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