Java interacts with c ++ encryption pit

Projects need to use AES encryption, and AES encryption, c ++ cocos client side there is no library, only with your own functions to encrypt; Java library function can not be used here, otherwise encryption that the results are inconsistent;

To the same, we need to ensure that: 1: Two (own implementation of the library function do not) use the same encryption function

2: When the processing of the string, both sides must first turn to a utf-8 format (for Chinese); otherwise the client VisualStudio, Chinese GBK format, a character, two bytes; UTF-8, a character, words section;

3: JAVA char in two bytes, byte one byte, unsigned and unsigned no concept; c ++ char inside a byte, byte one byte, unsigned concept has

 

Source code, we need to sort out, in mass up

Guess you like

Origin blog.csdn.net/qq_34326603/article/details/82187671