new line appending on my encrypted string

前端 未结 6 1542
长发绾君心
长发绾君心 2020-12-08 03:54

In Main:

public static void main(String[] args) throws NoSuchAlgorithmException {
    System.out.println(\"encrypt:\" + encryptPassword(\"superuser\")+\":\"          


        
6条回答
  •  感情败类
    2020-12-08 04:18

    I may be late in answering this, but came across with same problem. Actually problem lies here Base64.encodeBase64String(hashPassword)

    Change that line to look like this it should work: Base64.encodeBase64String(hashPassword,Base64.NO_WRAP)

    By default the Android Base64 util adds a newline character to the end of the encoded string. The Base64.NO_WRAP flag tells the util to create the encoded string without the newline character.

    Check here

提交回复
热议问题