How to classify following CRC4 implementation? - crc

I figured out the following CRC4 C code with polynomial 0x13 will work for me. But regarding crcany resp. CRC catalogue how to classify it?
uint8_t const crcTable[] = {
0x0, 0x3, 0x6, 0x5, 0xC, 0xF, 0xA, 0x9, 0xB, 0x8, 0xD, 0xE, 0x7, 0x4, 0x1, 0x2,
0x5, 0x6, 0x3, 0x0, 0x9, 0xA, 0xF, 0xC, 0xE, 0xD, 0x8, 0xB, 0x2, 0x1, 0x4, 0x7,
0xA, 0x9, 0xC, 0xF, 0x6, 0x5, 0x0, 0x3, 0x1, 0x2, 0x7, 0x4, 0xD, 0xE, 0xB, 0x8,
0xF, 0xC, 0x9, 0xA, 0x3, 0x0, 0x5, 0x6, 0x4, 0x7, 0x2, 0x1, 0x8, 0xB, 0xE, 0xD,
0x7, 0x4, 0x1, 0x2, 0xB, 0x8, 0xD, 0xE, 0xC, 0xF, 0xA, 0x9, 0x0, 0x3, 0x6, 0x5,
0x2, 0x1, 0x4, 0x7, 0xE, 0xD, 0x8, 0xB, 0x9, 0xA, 0xF, 0xC, 0x5, 0x6, 0x3, 0x0,
0xD, 0xE, 0xB, 0x8, 0x1, 0x2, 0x7, 0x4, 0x6, 0x5, 0x0, 0x3, 0xA, 0x9, 0xC, 0xF,
0x8, 0xB, 0xE, 0xD, 0x4, 0x7, 0x2, 0x1, 0x3, 0x0, 0x5, 0x6, 0xF, 0xC, 0x9, 0xA,
0xE, 0xD, 0x8, 0xB, 0x2, 0x1, 0x4, 0x7, 0x5, 0x6, 0x3, 0x0, 0x9, 0xA, 0xF, 0xC,
0xB, 0x8, 0xD, 0xE, 0x7, 0x4, 0x1, 0x2, 0x0, 0x3, 0x6, 0x5, 0xC, 0xF, 0xA, 0x9,
0x4, 0x7, 0x2, 0x1, 0x8, 0xB, 0xE, 0xD, 0xF, 0xC, 0x9, 0xA, 0x3, 0x0, 0x5, 0x6,
0x1, 0x2, 0x7, 0x4, 0xD, 0xE, 0xB, 0x8, 0xA, 0x9, 0xC, 0xF, 0x6, 0x5, 0x0, 0x3,
0x9, 0xA, 0xF, 0xC, 0x5, 0x6, 0x3, 0x0, 0x2, 0x1, 0x4, 0x7, 0xE, 0xD, 0x8, 0xB,
0xC, 0xF, 0xA, 0x9, 0x0, 0x3, 0x6, 0x5, 0x7, 0x4, 0x1, 0x2, 0xB, 0x8, 0xD, 0xE,
0x3, 0x0, 0x5, 0x6, 0xF, 0xC, 0x9, 0xA, 0x8, 0xB, 0xE, 0xD, 0x4, 0x7, 0x2, 0x1,
0x6, 0x5, 0x0, 0x3, 0xA, 0x9, 0xC, 0xF, 0xD, 0xE, 0xB, 0x8, 0x1, 0x2, 0x7, 0x4
};
uint8_t crc4(uint8_t const message[], int nBytes)
{
uint8_t data;
uint8_t remainder = 0;
for (int byte = 0; byte < nBytes; ++byte)
{
data = message[byte] ^ remainder;
remainder = (crcTable[data] ^ (remainder << 8)) << 4;
}
return (remainder >> 4);
}

That would be:
width=4 poly=3 init=0 refin=false refout=false xorout=0 check=0xe residue=0 name="CRC-4/USER3095936"
or abbreviated:
w=4 p=3 r=f c=14 n=CRC-4/USER3095936
By the way, the code has some odd things. The ^ (remainder << 8) does nothing at all, since that's always zero. You can just get rid of that. Second, you can avoid shifting in the loop by shifting all the table entries up four bits.

Related

How to output in file uchar? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have array of unsigned char[128] = {0xFF, 0xBE,...0x99};. And need to output it to .txt or .bin file. But all fuctions that I tried could work only with const char*.
So, what should I use to output uchar[]?
I tried fstream and QFile.
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
static uchar headerFile[128] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //1
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //2
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //3
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //4
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //5
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //6
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, //7
0xFF, 0xFF, 0x47, 0x01, 0x84, 0x75, 0x00, 0x00, 0x39, 0xC2, 0x3A, 0xBE, 0xC3, 0x72, 0xC4, 0x71,}; //8
int main()
{
QFile out("D:/DataOutput.bin");
if( out.open( QIODevice::WriteOnly ) ) {
out.write(&headerFile[0],128);
}
}
UPD: Delete loop.
This should work:
if (out.open(QIODevice::WriteOnly)) {
out.write(reinterpret_cast<const char*>(&headerFile[0]), 128);
}

Reading raw SSL/TLS Certificate from memory using OpenSSL

I'm having trouble using OpenSSL to parse certificates from bytes acquired from a pcap file. The data is coming directly from ssl.handshake.certificate field in Wireshark (when observing the pcap).
The raw data is from a pcap file i found from Wireshark. This is just the 10th packet and is a certificate with a commonName 'Ubuntu'. I believe my problem is that i'm giving the OpenSSL function data that is incorrectly formatted but i wouldve thought that it could handle network order bytes (as i have directly from a pcap).
const unsigned int raw[] = {
0x30, 0x82, 0x02, 0xb2, 0x30, 0x82, 0x01, 0x9a,
0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00,
0xcd, 0xdb, 0x2b, 0xb3, 0xe2, 0xa7, 0x1b, 0x88,
0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30,
0x11, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x03, 0x55,
0x04, 0x03, 0x13, 0x06, 0x75, 0x62, 0x75, 0x6e,
0x74, 0x75, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x35,
0x30, 0x31, 0x32, 0x37, 0x31, 0x36, 0x35, 0x35,
0x30, 0x31, 0x5a, 0x17, 0x0d, 0x32, 0x35, 0x30,
0x31, 0x32, 0x34, 0x31, 0x36, 0x35, 0x35, 0x30,
0x31, 0x5a, 0x30, 0x11, 0x31, 0x0f, 0x30, 0x0d,
0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x06, 0x75,
0x62, 0x75, 0x6e, 0x74, 0x75, 0x30, 0x82, 0x01,
0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48,
0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00,
0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01,
0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xf1, 0x85,
0x02, 0x0b, 0x26, 0x3d, 0x2d, 0xcd, 0xcc, 0x75,
0xc2, 0x1d, 0x51, 0x19, 0x7c, 0x1d, 0xbc, 0x1e,
0x14, 0xe5, 0x71, 0x6f, 0xfb, 0xaa, 0x2a, 0x8b,
0x2f, 0x69, 0xe3, 0xe7, 0xc7, 0xa4, 0xc4, 0x79,
0xef, 0x17, 0x0e, 0x4b, 0x37, 0xd8, 0x68, 0x00,
0x81, 0x6a, 0x62, 0x55, 0x79, 0x1d, 0x1d, 0x73,
0x6d, 0xbb, 0x20, 0x43, 0x4e, 0x21, 0x8b, 0xe8,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, 0x2d, 0x27, 0x00, 0x3a, 0x86, 0x73,
0x49, 0xa5, 0xd9, 0x01, 0x56, 0x5f, 0x02, 0x03,
0x01, 0x00, 0x01, 0xa3, 0x0d, 0x30, 0x0b, 0x30,
0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02,
0x30, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05,
0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x1d, 0x14,
0x29, 0xa8, 0x5f, 0x81, 0x2b, 0xae, 0x61, 0x36,
0x7b, 0x44, 0xbb, 0xc1, 0xa2, 0x11, 0x23, 0x21,
0x43, 0x98, 0xee, 0x42, 0xfa, 0x90, 0x01, 0x5a,
0xde, 0xd6, 0x80, 0x1f, 0xa4, 0x49, 0x4b, 0xaf,
0xf8, 0x9d, 0xb8, 0xa3, 0xc8, 0xf2, 0x0f, 0xdb,
0x33, 0x6d, 0xd7, 0x29, 0x6f, 0xda, 0xe3, 0x06,
0x51, 0xab, 0xbf, 0xd2, 0xb1, 0xee, 0x89, 0x24,
0x2c, 0x00, 0x5f, 0x71, 0x0a, 0xc9, 0xba, 0xde,
0x61, 0xa0, 0x82, 0x7e, 0x40, 0xb8, 0xbf, 0xd3,
0x75, 0x9a, 0xab, 0x96, 0x77, 0xb1, 0x8e, 0x1c,
0xad, 0xf7, 0x36, 0xbb, 0xfc, 0xc3, 0x30, 0x58,
0x38, 0x19, 0x19, 0x3a, 0xdd, 0xdb, 0x03, 0xed,
0x5a, 0x31, 0xb9, 0x74, 0x06, 0x63, 0x95, 0x41,
0x48, 0x66, 0x41, 0x63, 0xf5, 0x0b, 0x5d, 0x82,
0xe4, 0xaf, 0xfc, 0x47, 0x17, 0xed, 0x4e, 0xe3,
0x8d, 0x62, 0xf9, 0x6a, 0xec, 0xcb, 0xbb, 0x2c,
0xe7, 0x8c, 0x30, 0x49, 0xfa, 0x5f, 0xda, 0xdc,
0x18, 0x14, 0x9a, 0x9a, 0x7a, 0x0f, 0xbf, 0x47,
0x22, 0x46, 0x00, 0x7b, 0xf9, 0xed, 0xd8, 0x52,
0x48, 0x32, 0x84, 0x93, 0x41, 0x50, 0x2f, 0x31,
0xf6, 0x1d, 0xfc, 0x69, 0x0d, 0x30, 0xd0, 0xda,
0x44, 0x65, 0x85, 0xde, 0x0c, 0x2c, 0x92, 0x9c,
0x42, 0xd7, 0x40, 0xe2, 0xbc, 0x7d, 0xd3, 0x93,
0xad, 0x63, 0x42, 0xe3, 0x95, 0xc4, 0xaf, 0xa2,
0x3d, 0xd6, 0x02, 0x1c, 0xf9, 0x28, 0xd2, 0xe8,
0x18, 0xa0, 0x6f, 0xb0, 0x42, 0x4c, 0x9a, 0x75,
0xca, 0x49, 0xb6, 0xa2, 0x66, 0x3d, 0xa2, 0x21,
0x76, 0xfa, 0xbd, 0xe6, 0x66, 0x73, 0x04, 0x35,
0xde, 0x6b, 0x1a, 0xb9, 0x3f, 0xa0, 0x06, 0xd5,
0x39, 0x0e, 0xc3, 0xfa, 0xe2, 0x6f, 0x7f, 0xb3,
0x4d, 0xee, 0x54, 0x38, 0x78, 0x3b, 0x1b, 0x2e,
0x71, 0xc2, 0xc5, 0x2d, 0xca, 0xf1
};
const unsigned char* data = reinterpret_cast<const unsigned char*>(raw);
size_t len = sizeof(raw)/sizeof(raw[0]);
X509 *cert = d2i_X509(NULL, &data, len);
This will always return cert as NULL and i'm stuck because this seemed like a simple procedure.
Your raw array is the wrong type. That is supposed to be a sequence of simple octets (unsigned char, uint8_t, pick your poison).
Changed as described above, the certificate is extracted successfully:
Code
#include <stdio.h>
#include <openssl/evp.h>
#include <openssl/x509.h>
const unsigned char raw[] = // <<======= HERE
{
0x30, 0x82, 0x02, 0xb2, 0x30, 0x82, 0x01, 0x9a,
0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00,
0xcd, 0xdb, 0x2b, 0xb3, 0xe2, 0xa7, 0x1b, 0x88,
0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30,
0x11, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x03, 0x55,
0x04, 0x03, 0x13, 0x06, 0x75, 0x62, 0x75, 0x6e,
0x74, 0x75, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x35,
0x30, 0x31, 0x32, 0x37, 0x31, 0x36, 0x35, 0x35,
0x30, 0x31, 0x5a, 0x17, 0x0d, 0x32, 0x35, 0x30,
0x31, 0x32, 0x34, 0x31, 0x36, 0x35, 0x35, 0x30,
0x31, 0x5a, 0x30, 0x11, 0x31, 0x0f, 0x30, 0x0d,
0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x06, 0x75,
0x62, 0x75, 0x6e, 0x74, 0x75, 0x30, 0x82, 0x01,
0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48,
0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00,
0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01,
0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xf1, 0x85,
0x02, 0x0b, 0x26, 0x3d, 0x2d, 0xcd, 0xcc, 0x75,
0xc2, 0x1d, 0x51, 0x19, 0x7c, 0x1d, 0xbc, 0x1e,
0x14, 0xe5, 0x71, 0x6f, 0xfb, 0xaa, 0x2a, 0x8b,
0x2f, 0x69, 0xe3, 0xe7, 0xc7, 0xa4, 0xc4, 0x79,
0xef, 0x17, 0x0e, 0x4b, 0x37, 0xd8, 0x68, 0x00,
0x81, 0x6a, 0x62, 0x55, 0x79, 0x1d, 0x1d, 0x73,
0x6d, 0xbb, 0x20, 0x43, 0x4e, 0x21, 0x8b, 0xe8,
0x67, 0xb6, 0x0e, 0xfd, 0xde, 0x15, 0x18, 0xff,
0x9f, 0x0d, 0x2b, 0xf6, 0x61,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0x03,
0x01, 0x00, 0x01, 0xa3, 0x0d, 0x30, 0x0b, 0x30,
0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02,
0x30, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05,
0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x1d, 0x14,
0x29, 0xa8, 0x5f, 0x81, 0x2b, 0xae, 0x61, 0x36,
0x7b, 0x44, 0xbb, 0xc1, 0xa2, 0x11, 0x23, 0x21,
0x43, 0x98, 0xee, 0x42, 0xfa, 0x90, 0x01, 0x5a,
0xde, 0xd6, 0x80, 0x1f, 0xa4, 0x49, 0x4b, 0xaf,
0xf8, 0x9d, 0xb8, 0xa3, 0xc8, 0xf2, 0x0f, 0xdb,
0x33, 0x6d, 0xd7, 0x29, 0x6f, 0xda, 0xe3, 0x06,
0x51, 0xab, 0xbf, 0xd2, 0xb1, 0xee, 0x89, 0x24,
0x2c, 0x00, 0x5f, 0x71, 0x0a, 0xc9, 0xba, 0xde,
0x61, 0xa0, 0x82, 0x7e, 0x40, 0xb8, 0xbf, 0xd3,
0x75, 0x9a, 0xab, 0x96, 0x77, 0xb1, 0x8e, 0x1c,
0xad, 0xf7, 0x36, 0xbb, 0xfc, 0xc3, 0x30, 0x58,
0x38, 0x19, 0x19, 0x3a, 0xdd, 0xdb, 0x03, 0xed,
0x5a, 0x31, 0xb9, 0x74, 0x06, 0x63, 0x95, 0x41,
0x48, 0x66, 0x41, 0x63, 0xf5, 0x0b, 0x5d, 0x82,
0xe4, 0xaf, 0xfc, 0x47, 0x17, 0xed, 0x4e, 0xe3,
0x8d, 0x62, 0xf9, 0x6a, 0xec, 0xcb, 0xbb, 0x2c,
0xe7, 0x8c, 0x30, 0x49, 0xfa, 0x5f, 0xda, 0xdc,
0x18, 0x14, 0x9a, 0x9a, 0x7a, 0x0f, 0xbf, 0x47,
0x22, 0x46, 0x00, 0x7b, 0xf9, 0xed, 0xd8, 0x52,
0x48, 0x32, 0x84, 0x93, 0x41, 0x50, 0x2f, 0x31,
0xf6, 0x1d, 0xfc, 0x69, 0x0d, 0x30, 0xd0, 0xda,
0x44, 0x65, 0x85, 0xde, 0x0c, 0x2c, 0x92, 0x9c,
0x42, 0xd7, 0x40, 0xe2, 0xbc, 0x7d, 0xd3, 0x93,
0xad, 0x63, 0x42, 0xe3, 0x95, 0xc4, 0xaf, 0xa2,
0x3d, 0xd6, 0x02, 0x1c, 0xf9, 0x28, 0xd2, 0xe8,
0x18, 0xa0, 0x6f, 0xb0, 0x42, 0x4c, 0x9a, 0x75,
0xca, 0x49, 0xb6, 0xa2, 0x66, 0x3d, 0xa2, 0x21,
0x76, 0xfa, 0xbd, 0xe6, 0x66, 0x73, 0x04, 0x35,
0xde, 0x6b, 0x1a, 0xb9, 0x3f, 0xa0, 0x06, 0xd5,
0x39, 0x0e, 0xc3, 0xfa, 0xe2, 0x6f, 0x7f, 0xb3,
0x4d, 0xee, 0x54, 0x38, 0x78, 0x3b, 0x1b, 0x2e,
0x71, 0xc2, 0xc5, 0x2d, 0xca, 0xf1
};
int main()
{
OpenSSL_add_all_ciphers();
OpenSSL_add_all_digests();
OpenSSL_add_all_algorithms();
const unsigned char *data = raw;
size_t len = sizeof(raw) / sizeof(raw[0]);
X509 *cert = d2i_X509(NULL, &data, (long)len);
printf("%p\n", cert);
if (cert)
{
X509_NAME *name = X509_get_issuer_name(cert);
if (name)
printf("Issuer: %s\n", X509_NAME_oneline(name, NULL, 0));
X509_free(cert);
}
return 0;
}
Output (pointer value varies)
0000018ACA51BEB0
Issuer: /CN=ubuntu

Loading byte array (from memory) to LibPNG c++

Instead of using 'png_init_io' I'm trying to use 'png_set_read_fn' to provide a custom function to load a byte array from memory instead of from file.
Why would this be happening.. It seems to be failing at:
if (setjmp(png_jmpbuf(png_ctx)) != 0)
{
png_destroy_read_struct(&png_ctx, &info_ctx, NULL);
free(img_data); free(row_data);
return (1); /* libpng feedback (?) */
}
This is my code so far, the PNG data is at the end of the file
#ifndef __EMBEDDEDPNG_H__
#define __EMBEDDEDPNG_H__
#include <png.h>
typedef struct {
const png_byte* data;
const png_size_t size;
} DataHandle;
typedef struct {
const DataHandle data;
png_size_t offset;
} ReadDataHandle;
#include <GL/gl.h>
#include <algorithm>
#define PNG_SIG_BYTES (8) /* bytes in the PNG file signature. */
using byte = unsigned char;
#define PNG_RGBA_PIXEL_LIMIT (0x1000000)
static int
png_rgba_pixel_limit(png_uint_32 w, png_uint_32 h)
{
double da;
/* assert(w != 0 && h != 0); */
if (w > PNG_RGBA_PIXEL_LIMIT || h > PNG_RGBA_PIXEL_LIMIT)
return (1); /* since both (w) and (h) are non-zero. */
/* since an IEEE-754 double has a 53 bit mantissa, it can
* represent the maximum area: (w * h == 2^48) exactly. */
da = ((double)w) * ((double)h);
if (da > ((double)PNG_RGBA_PIXEL_LIMIT))
return (1);
return (0); /* the PNG image is within the pixel limit. */
}
class EmbeddedPNG
{
public:
byte *Data;
public:
size_t Read(byte* dest, const size_t byteCount);
unsigned int Load(int &width, int &height);
};
void ReadDataFromInputStream(
png_structp png_ptr, png_byte* raw_data, png_size_t read_length) {
ReadDataHandle* handle = (ReadDataHandle*)png_get_io_ptr(png_ptr);
const png_byte* png_src = handle->data.data + handle->offset;
memcpy(raw_data, png_src, read_length);
handle->offset += read_length;
}
size_t EmbeddedPNG::Read(byte* dest, const size_t byteCount)
{
std::copy(Data + 0, Data + byteCount, dest);
return byteCount;
}
unsigned int EmbeddedPNG::Load(int &width, int &height)
{
png_byte magic[PNG_SIG_BYTES]; /* (signature byte buffer) */
png_structp png_ctx;
png_infop info_ctx;
png_uint_32 img_width, img_height, row;
png_byte img_depth, img_color_type;
/* 'volatile' qualifier forces reload in setjmp cleanup: */
png_byte *volatile img_data = NULL;
png_bytep *volatile row_data = NULL;
;//*buf = NULL;
/* it is assumed that 'longjmp' can be invoked within this
* code to efficiently unwind resources for *all* errors. */
/* PNG structures and resource unwinding: */
if ((png_ctx = png_create_read_struct(
PNG_LIBPNG_VER_STRING, NULL, NULL, NULL)) == NULL)
return (1); /* ENOMEM (?) */
if ((info_ctx = png_create_info_struct(png_ctx)) == NULL)
{
png_destroy_read_struct(&png_ctx, NULL, NULL);
return (1); /* ENOMEM (?) */
}
if (setjmp(png_jmpbuf(png_ctx)) != 0)
{
png_destroy_read_struct(&png_ctx, &info_ctx, NULL);
free(img_data); free(row_data);
return (1); /* libpng feedback (?) */
}
/* check PNG file signature: */
//if (fread(magic, (1), PNG_SIG_BYTES, fp) != PNG_SIG_BYTES)
// png_error(png_ctx, "invalid PNG file");
Read(magic, PNG_SIG_BYTES);
if (png_sig_cmp(magic, 0, PNG_SIG_BYTES))
png_error(png_ctx, "invalid PNG file");
/* set the input file stream and get the PNG image info: */
//png_init_io(png_ctx, fp);
ReadDataHandle a = ReadDataHandle{ { Data, 898 }, 0 };
png_set_read_fn(png_ctx, &a, ReadDataFromInputStream);
//png_set_read_fn(png_ptr, NULL, ReadDataFromInputStream);
png_set_sig_bytes(png_ctx, PNG_SIG_BYTES);
//////////////// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
png_read_info(png_ctx, info_ctx);
img_width = png_get_image_width(png_ctx, info_ctx);
img_height = png_get_image_height(png_ctx, info_ctx);
#if (1) /* PNG doesn't support zero area image? */
if (img_width == 0 || img_height == 0)
png_error(png_ctx, "zero area PNG image");
#endif
if (png_rgba_pixel_limit(img_width, img_height))
png_error(png_ctx, "PNG image exceeds pixel limits");
img_depth = png_get_bit_depth(png_ctx, info_ctx);
img_color_type = png_get_color_type(png_ctx, info_ctx);
/* ignored image interlacing, compression and filtering. */
/* force 8-bit color channels: */
if (img_depth == 16)
png_set_strip_16(png_ctx);
else if (img_depth < 8)
png_set_packing(png_ctx);
/* force formats to RGB: */
if (img_color_type != PNG_COLOR_TYPE_RGBA)
png_set_expand(png_ctx);
if (img_color_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb(png_ctx);
if (img_color_type == PNG_COLOR_TYPE_GRAY)
png_set_gray_to_rgb(png_ctx);
if (img_color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ctx);
/* add full opacity alpha channel if required: */
if (img_color_type != PNG_COLOR_TYPE_RGBA)
png_set_filler(png_ctx, 0xff, PNG_FILLER_AFTER);
/* apply the output transforms before reading image data: */
png_read_update_info(png_ctx, info_ctx);
/* allocate RGBA image data: */
img_data = (png_byte *)
malloc((size_t)(img_width * img_height * (4)));
if (img_data == NULL)
png_error(png_ctx, "error allocating image buffer");
/* allocate row pointers: */
row_data = (png_bytep *)
malloc((size_t)(img_height * sizeof(png_bytep)));
if (row_data == NULL)
png_error(png_ctx, "error allocating row pointers");
/* set the row pointers and read the RGBA image data: */
for (row = 0; row < img_height; row++)
row_data[row] = img_data +
(img_height - (row + 1)) * (img_width * (4));
png_read_image(png_ctx, row_data);
/* libpng and dynamic resource unwinding: */
png_read_end(png_ctx, NULL);
png_destroy_read_struct(&png_ctx, &info_ctx, NULL);
free(row_data);
//*w = (unsigned) img_width, *h = (unsigned) img_height;
width = img_width;
height = img_height;
//*buf = img_data; /* (asserts png_byte is an unsigned char) */
//Now generate the OpenGL texture object
GLuint texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); // Important!
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)img_data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
return texture;
}
class EmbeddedPNG_Icon_HandShake
: public EmbeddedPNG
{
public:
EmbeddedPNG_Icon_HandShake()
{
Data = new byte[898]{ 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x08, 0x04, 0x00, 0x00, 0x00, 0xD9, 0x73, 0xB2, 0x7F, 0x00, 0x00, 0x00, 0x04, 0x67, 0x41, 0x4D, 0x41, 0x00, 0x00, 0xB1, 0x8F, 0x0B, 0xFC, 0x61, 0x05, 0x00, 0x00, 0x00, 0x20, 0x63, 0x48, 0x52, 0x4D, 0x00, 0x00, 0x7A, 0x26, 0x00, 0x00, 0x80, 0x84, 0x00, 0x00, 0xFA, 0x00, 0x00, 0x00, 0x80, 0xE8, 0x00, 0x00, 0x75, 0x30, 0x00, 0x00, 0xEA, 0x60, 0x00, 0x00, 0x3A, 0x98, 0x00, 0x00, 0x17, 0x70, 0x9C, 0xBA, 0x51, 0x3C, 0x00, 0x00, 0x00, 0x02, 0x62, 0x4B, 0x47, 0x44, 0x00, 0x00, 0xAA, 0x8D, 0x23, 0x32, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0D, 0xD7, 0x00, 0x00, 0x0D, 0xD7, 0x01, 0x42, 0x28, 0x9B, 0x78, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4D, 0x45, 0x07, 0xE1, 0x05, 0x1D, 0x15, 0x3A, 0x07, 0xDA, 0x7F, 0x48, 0xF4, 0x00, 0x00, 0x02, 0x50, 0x49, 0x44, 0x41, 0x54, 0x48, 0xC7, 0xD5, 0xD3, 0x4B, 0x68, 0x94, 0x57, 0x18, 0x06, 0xE0, 0x6F, 0x4C, 0x0C, 0x9A, 0xE2, 0x2D, 0x1A, 0xD1, 0x8A, 0x44, 0x57, 0x5A, 0xCD, 0xA2, 0xA8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 0x5E, 0x80, 0x35, 0x3A, 0xA7, 0xDD, 0x8E, 0xFF, 0x18, 0xFF, 0x1F, 0xE6, 0x5F, 0x1F, 0xA9, 0x98, 0xCC, 0x0D, 0x77, 0xF1, 0x32, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3A, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x31, 0x37, 0x2D, 0x30, 0x35, 0x2D, 0x32, 0x39, 0x54, 0x32, 0x31, 0x3A, 0x35, 0x38, 0x3A, 0x30, 0x37, 0x2B, 0x30, 0x32, 0x3A, 0x30, 0x30, 0x19, 0xBB, 0x75, 0xB7, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3A, 0x6D, 0x6F, 0x64, 0x69, 0x66, 0x79, 0x00, 0x32, 0x30, 0x31, 0x37, 0x2D, 0x30, 0x35, 0x2D, 0x32, 0x39, 0x54, 0x32, 0x31, 0x3A, 0x35, 0x38, 0x3A, 0x30, 0x37, 0x2B, 0x30, 0x32, 0x3A, 0x30, 0x30, 0x68, 0xE6, 0xCD, 0x0B, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x77, 0x77, 0x77, 0x2E, 0x69, 0x6E, 0x6B, 0x73, 0x63, 0x61, 0x70, 0x65, 0x2E, 0x6F, 0x72, 0x67, 0x9B, 0xEE, 0x3C, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82 };
}
};
#endif
Don't call
png_set_sig_bytes(png_ctx, PNG_SIG_BYTES);
This signals libpng to skip reading the signature bytes causing your offset to be wrong when you start reading the png data. Offset points to zero and libpng assumes that it's already 8 (or more accurately that there is no signature in the stream).
Source: I ran this through a debugger.

Getting wxImage in a panel

I've a problem to get a wxImage into a wxPanel.
I want to create a .exe with some pics in the exe, but I want to avoid to give the PNG-Pics with the exe.
So far, I get the PNGs into the exe with this:
wxStaticBitmap *image = new wxStaticBitmap(p_img, wxID_ANY,
wxBitmap("Bild.png", wxBITMAP_TYPE_PNG),
wxPoint(0,0),
wxSize(width, height);
where p_img ist the panel and Bild.png the picture.
Now, I have followed http://wiki.wxwidgets.org/WxImage And have now a wxImage... But I don't know how I can get the wxImage in the panel.
wxMemoryInputStream istream1(Bild_png, sizeof Bild_png);
wxImage Bild_png(istream1, wxBITMAP_TYPE_PNG);
I hope somebody has a idea.
-Casisto
My System:
OS: Win 8.1; wxW 2.9.4; IDE: CodeLite5.1
You can pass wxImage into wxBitmap constructor (wxBitmap Class Reference):
wxBitmap(const wxImage &img, int depth=wxBITMAP_SCREEN_DEPTH)
And then you can create wxStaticBitmap. So the code would be something like that:
wxImage Bild_png(istream1, wxBITMAP_TYPE_PNG);
wxStaticBitmap *staticBitmap = new wxStaticBitmap(p_img, wxID_ANY, wxBitmap(Bild_png));
As I understand you want to use the images and do not want to ship with exe as a physical files on the file system.
For Windows platform resource only Dll can be used. If you want cross platform you can use following technique:
Convert your PNG file to C++ style array.
And use this C++ array to create wxImage object.
You can download the application to get C++ array from:
http://sourceforge.net/projects/png2cscc/
you will get C++ array like below and put this array in some source file of your project.
static const unsigned int the_sizeof_swdXW_bytes = 2304 ;
static const unsigned char the_swdXW_bytes[ the_sizeof_swdXW_bytes ] =
{
0xED, 0xF8, 0xFC, 0xFF, 0xEB, 0xF4, 0xF9, 0xFF, 0xEF, 0xF3, 0xFC, 0xFF, 0xF4, 0xF7, 0xFF, 0xFF,
0xF7, 0xF7, 0xFF, 0xFF, 0xEE, 0xF1, 0xFA, 0xFF, 0xEB, 0xF0, 0xF6, 0xFF, 0xF1, 0xF9, 0xFC, 0xFF,
0xEE, 0xF8, 0xFA, 0xFF, 0xED, 0xF6, 0xF5, 0xFF, 0xEC, 0xF2, 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0x19, 0xFF, 0x0B, 0x0B, 0x0D, 0xFF, 0x3F, 0x37, 0x35, 0xFF,
0xA4, 0x91, 0x8B, 0xFF, 0x91, 0x7E, 0x78, 0xFF, 0x69, 0x5F, 0x60, 0xFF, 0x5E, 0x59, 0x5D, 0xFF,
0xBA, 0xBB, 0xB5, 0xFF, 0xB9, 0xBA, 0xB4, 0xFF, 0xBA, 0xB9, 0xB4, 0xFF, 0xB2, 0xB1, 0xAC, 0xFF,
0xAB, 0xA7, 0xA4, 0xFF, 0x8D, 0x89, 0x88, 0xFF, 0x3E, 0x3C, 0x3D, 0xFF, 0x6E, 0x6D, 0x72, 0xFF,
0x41, 0x40, 0x46, 0xFF, 0x14, 0x14, 0x1C, 0xFF, 0x13, 0x15, 0x21, 0xFF, 0x16, 0x18, 0x24, 0xFF,
0x11, 0x13, 0x1F, 0xFF, 0x16, 0x18, 0x24, 0xFF, 0x11, 0x14, 0x1D, 0xFF, 0x16, 0x19, 0x22, 0xFF,
0x15, 0x1A, 0x20, 0xFF, 0x11, 0x14, 0x19, 0xFF, 0x10, 0x10, 0x12, 0xFF, 0x2B, 0x23, 0x20, 0xFF,
0x7E, 0x67, 0x61, 0xFF, 0x85, 0x6E, 0x68, 0xFF, 0x6B, 0x5F, 0x5F, 0xFF, 0xCB, 0xC5, 0xC9, 0xFF
};

c++ Decrypting msg from game client

i made a socket that accepting connection from a game , in the game u should type in username and password , i can recive it bt , it's like ummmm encrypted letteers and numbers(”VeDbç)
3¥ثuo_‰°"“Fِمض)
my question is where to look at so i can understand how to deal with this prob , is there a tut. or hint or somthing that i can work on so i can reach what am looking for!?
thanks.
unsigned char* Key3;
unsigned char* Key4;
unsigned char Low;
unsigned char High;
const unsigned char Key1[] =
{
0x9D, 0x90, 0x83, 0x8A, 0xD1, 0x8C, 0xE7, 0xF6, 0x25, 0x28, 0xEB, 0x82, 0x99, 0x64, 0x8F, 0x2E,
0x2D, 0x40, 0xD3, 0xFA, 0xE1, 0xBC, 0xB7, 0x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 0xCF, 0x68, 0x95, 0x5E, 0x6B, 0x84, 0x11, 0x9A, 0x47, 0x60, 0xCD, 0x96, 0x63, 0xFC, 0xC9,
0x52, 0xBF, 0x58, 0x05, 0xCE, 0x5B, 0x74, 0x81, 0x0A, 0x37, 0x50, 0x3D, 0x06, 0x53, 0xEC, 0x39,
0xC2, 0xAF, 0x48, 0x75, 0x3E, 0x4B, 0x64, 0xF1, 0x7A, 0x27, 0x40, 0xAD, 0x76, 0x43, 0xDC, 0xA9,
0x32, 0x9F, 0x38, 0xE5, 0xAE, 0x3B, 0x54, 0x61, 0xEA, 0x17, 0x30, 0x1D, 0xE6, 0x33, 0xCC, 0x19,
0xA2, 0x8F, 0x28, 0x55, 0x1E, 0x2B, 0x44, 0xD1, 0x5A, 0x07, 0x20, 0x8D, 0x56, 0x23, 0xBC, 0x89,
0x12, 0x7F, 0x18, 0xC5, 0x8E, 0x1B, 0x34, 0x41, 0xCA, 0xF7, 0x10, 0xFD, 0xC6, 0x13, 0xAC, 0xF9,
0x82, 0x6F, 0x08, 0x35, 0xFE, 0x0B, 0x24, 0xB1, 0x3A, 0xE7, 0x00, 0x6D, 0x36, 0x03, 0x9C, 0x69,
0xF2, 0x5F, 0xF8, 0xA5, 0x6E, 0xFB, 0x14, 0x21, 0xAA, 0xD7, 0xF0, 0xDD, 0xA6, 0xF3, 0x8C, 0xD9
};
// Decrypt Function
void CAuthCryptography::Decrypt(void* in, void* out, int Length)
{
unsigned char* pIn = (unsigned char*)in;
unsigned char* pOut = (unsigned char*)out;
for (int i = 0; i < Length; i++)
{
pOut[i] = (unsigned char)(pIn[i] ^ 0xAB);
pOut[i] = (unsigned char)((pOut[i] << 4) | (pOut[i] >> 4));
if (UsingAlternate)
{
pOut[i] = (unsigned char)(Key4[In.High] ^ pOut[i]);
pOut[i] = (unsigned char)(Key3[In.Low] ^ pOut[i]);
}
else
{
pOut[i] = (unsigned char)(Key2[In.High] ^ pOut[i]);
pOut[i] = (unsigned char)(Key1[In.Low] ^ pOut[i]);
}
In.Counter++;
}
}
i got this code and it's working but can someone explain to me how it's working becuase i dont understand it?!
or if there is a tut. i can read or something
I suggest you use something like WireShark, tcpdump etc to view the TCP stream, just to make sure you haven't bodged up your tcp data-reading code. More generally, if you are getting data like that, then only the sending side will know why, and you either ask them or look at how that data is handled by some other receiving program they've made (i.e. debug another client, find out what it does with that mess).
When it really is encrypted, your chances are low.
But chances are it's just UTF-7 or UTF-8 encoded, not encrypted.
And if it is SSL on a non-standard port, use oSpy.