也就是
guint8* output = NULL;
output = (guint8*) g_malloc0 (0x20);
和
guint8 output[ 0x20 ];
的不同?
- int main()
- {
- guint8 input[] = {0x10, 0xf3, 0x07, 0xb7, 0x12, 0x4d, 0x06, 0x9b, 0x31, 0xc9, 0xf0, 0x00, 0x87, 0x43,
- 0x1a, 0x67, 0xc0, 0x7f, 0x9e, 0x2c, 0x13, 0xb3, 0x90, 0x14, 0xd0, 0x91, 0xe4, 0x09, 0x5a, 0x6e, 0xdf, 0x21};
- guint8 key[] = {0xd7, 0x87, 0x7e, 0xf4, 0x2e, 0x9e, 0x26, 0x77, 0x76, 0x94, 0x1e, 0x42, 0x3c, 0x0f, 0x81, 0xd6};
- guint8* output = NULL;
- output = g_malloc0( 0x20);
- guint16 output_len = qq_decrypt(output, input, 0x20, key);
- g_print ("OUTPUT_LEN = %d\n",output_len);
- }
- [red]运行错误[/red]
- ---------------------------------------
- int main()
- {
- guint8 input[] = {0x10, 0xf3, 0x07, 0xb7, 0x12, 0x4d, 0x06, 0x9b, 0x31, 0xc9, 0xf0, 0x00, 0x87, 0x43,
- 0x1a, 0x67, 0xc0, 0x7f, 0x9e, 0x2c, 0x13, 0xb3, 0x90, 0x14, 0xd0, 0x91, 0xe4, 0x09, 0x5a, 0x6e, 0xdf, 0x21};
- guint8 key[] = {0xd7, 0x87, 0x7e, 0xf4, 0x2e, 0x9e, 0x26, 0x77, 0x76, 0x94, 0x1e, 0x42, 0x3c, 0x0f, 0x81, 0xd6};
- guint8 output[sizeof (input)];
- guint16 output_len = qq_decrypt(output, input, 0x20, key);
- g_print ("OUTPUT_LEN = %d\n",output_len);
- }
- [red]运行正常[/red]
复制代码
qq_crypt 定义:
gint qq_decrypt(guint8 *plain, const guint8* const crypted, const gint crypted_len, const guint8* const key) |