Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void cCamCryptVG_SetSeed(struct s_reader *reader)
- {
- #if __BYTE_ORDER != __BIG_ENDIAN
- static const uint8_t key1[] =
- {
- 0xb9, 0xd5, 0xef, 0xd5, 0xf5, 0xd5, 0xfb, 0xd5, 0x31, 0xd6, 0x43, 0xd6, 0x55, 0xd6, 0x61, 0xd6,
- 0x85, 0xd6, 0x9d, 0xd6, 0xaf, 0xd6, 0xc7, 0xd6, 0xd9, 0xd6, 0x09, 0xd7, 0x15, 0xd7, 0x21, 0xd7,
- 0x27, 0xd7, 0x3f, 0xd7, 0x45, 0xd7, 0xb1, 0xd7, 0xbd, 0xd7, 0xdb, 0xd7, 0x11, 0xd8, 0x23, 0xd8,
- 0x29, 0xd8, 0x2f, 0xd8, 0x4d, 0xd8, 0x8f, 0xd8, 0xa1, 0xd8, 0xad, 0xd8, 0xbf, 0xd8, 0xd7, 0xd8
- };
- void cCamCryptVG_GetCamKey(struct s_reader *reader, uint16_t *tb2)
- {
- struct videoguard_data *csystem_data = reader->csystem_data;
- uint16_t c = 1;
- memset(tb2, 0, 64);
- tb2[0] = 1;
- int32_t i;
- for(i = 0; i < 32; i++)
- {
- cCamCryptVG_LongMult(tb2, &c, csystem_data->cardkeys[1][i], 0);
- }
- swap_lb((uint8_t *)tb2, 64);
- }
- static void swap_lb(uint8_t *buff, int32_t len)
- {
- #if __BYTE_ORDER != __BIG_ENDIAN
- return;
- #endif
- int32_t i;
- uint8_t tmp;
- for(i = 0; i < len / 2; i++)
- {
- tmp = buff[i * 2];
- buff[i * 2] = buff[(i * 2) + 1];
- buff[(i * 2) + 1] = tmp;
- }
- }
- static void cCamCryptVG_LongMult(uint16_t *pData, uint16_t *pLen, uint32_t mult, uint32_t carry)
- {
- int32_t i;
- for(i = 0; i < *pLen; i++)
- {
- carry += pData[i] * mult;
- pData[i] = (uint16_t)carry;
- carry »= 16;
- }
- if(carry) { pData[(*pLen)++] = carry; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement