Why does my encrypted string looks like consisting of only question marks?

前端 未结 2 946
猫巷女王i
猫巷女王i 2020-12-12 01:41

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

2条回答
  •  青春惊慌失措
    2020-12-12 02:32

    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.

提交回复
热议问题