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

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

问题描述

我在使用Java加密字符串,当我打印加密的数据时,我只看到问号。



例如:




  • 纯文字: jjkkjlkljkj


  • 加密文字:


  • p>再次解密此文本后,我再次收到 jjkkjlkljkj




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

解决方案

是的,因为你不能打印从加密。



请注意,将加密结果保存在字符串中可能会导致数据丢失 ,因此不要这样做。将其作为字节数组,并将其转换为可显示的格式,如 Base64 或只是简单的Hex 。


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

As an example:

  • Plain text: jjkkjlkljkj

  • Encrypted text: ???????????

  • 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.

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天全站免登陆