List of all members.
Public Member Functions |
| void | Init (const unsigned char *key, int length, bool l=false) |
| void | Decrypt (const unsigned char *in, unsigned char *out, int length) |
| void | DecryptRC4 (const unsigned char *in, unsigned char *out, int length) |
| void | Encrypt (const unsigned char *in, unsigned char *out, int length) |
| void | Init (const unsigned char *key, int length, bool l=false) |
| void | Decrypt (const unsigned char *in, unsigned char *out, int length) |
| void | DecryptRC4 (const unsigned char *in, unsigned char *out, int length) |
| void | Encrypt (const unsigned char *in, unsigned char *out, int length) |
Static Public Member Functions |
| static void | ScrambleDcw (unsigned char *data, const unsigned char *nodeid, unsigned int shareid) |
| static bool | DcwChecksum (const unsigned char *data) |
| static bool | CheckConnectChecksum (const unsigned char *data, int length) |
| static void | Xor (unsigned char *data, int length) |
| static void | ScrambleDcw (unsigned char *data, const unsigned char *nodeid, unsigned int shareid) |
| static bool | DcwChecksum (const unsigned char *data) |
| static bool | CheckConnectChecksum (const unsigned char *data, int length) |
| static void | Xor (unsigned char *data, int length) |
Detailed Description
Definition at line 41 of file cccam2.c.
Member Function Documentation
| bool cCCcamCrypt::CheckConnectChecksum |
( |
const unsigned char * |
data, |
|
|
int |
length |
|
) |
| [static] |
| static bool cCCcamCrypt::CheckConnectChecksum |
( |
const unsigned char * |
data, |
|
|
int |
length |
|
) |
| [static] |
| bool cCCcamCrypt::DcwChecksum |
( |
const unsigned char * |
data | ) |
[static] |
| static bool cCCcamCrypt::DcwChecksum |
( |
const unsigned char * |
data | ) |
[static] |
| void cCCcamCrypt::Decrypt |
( |
const unsigned char * |
in, |
|
|
unsigned char * |
out, |
|
|
int |
length |
|
) |
| |
| void cCCcamCrypt::Decrypt |
( |
const unsigned char * |
in, |
|
|
unsigned char * |
out, |
|
|
int |
length |
|
) |
| |
| void cCCcamCrypt::DecryptRC4 |
( |
const unsigned char * |
in, |
|
|
unsigned char * |
out, |
|
|
int |
length |
|
) |
| |
| void cCCcamCrypt::DecryptRC4 |
( |
const unsigned char * |
in, |
|
|
unsigned char * |
out, |
|
|
int |
length |
|
) |
| |
Definition at line 85 of file cccam2.c.
References L_CC_CCCAM2EX, and LDUMP.
{
for(int pos=0; pos<length; pos++) {
sum+=keytable[++counter];
Swap(keytable+counter,keytable+sum);
out[pos]=in[pos] ^ keytable[(keytable[sum]+keytable[counter])&0xFF];
state^=out[pos];
}
if(log) LDUMP(L_CC_CCCAM2EX,keytable,sizeof(keytable),"rc4crypt decrypt state=%d table",state);
}
| void cCCcamCrypt::Encrypt |
( |
const unsigned char * |
in, |
|
|
unsigned char * |
out, |
|
|
int |
length |
|
) |
| |
| void cCCcamCrypt::Encrypt |
( |
const unsigned char * |
in, |
|
|
unsigned char * |
out, |
|
|
int |
length |
|
) |
| |
| void cCCcamCrypt::Init |
( |
const unsigned char * |
key, |
|
|
int |
length, |
|
|
bool |
l = false |
|
) |
| |
| void cCCcamCrypt::Init |
( |
const unsigned char * |
key, |
|
|
int |
length, |
|
|
bool |
l = false |
|
) |
| |
Definition at line 59 of file cccam2.c.
References L_CC_CCCAM2EX, and LDUMP.
Referenced by cCardClientCCcam2::Login(), and cCmd0cCrypt::SetKey().
{
log=l;
for(int pos=0; pos<=255; pos++) keytable[pos]=pos;
int result=0;
unsigned char curr_char=0;
for(int pos=0; pos<=255; pos++) {
curr_char+=keytable[pos] + key[result];
Swap(keytable+pos,keytable+curr_char);
result=(result+1)%length;
}
state=key[0]; counter=0; sum=0;
if(log) LDUMP(L_CC_CCCAM2EX,keytable,sizeof(keytable),"cccrypt init state=%d table",state);
}
| static void cCCcamCrypt::ScrambleDcw |
( |
unsigned char * |
data, |
|
|
const unsigned char * |
nodeid, |
|
|
unsigned int |
shareid |
|
) |
| [static] |
| void cCCcamCrypt::ScrambleDcw |
( |
unsigned char * |
data, |
|
|
const unsigned char * |
nodeid, |
|
|
unsigned int |
shareid |
|
) |
| [static] |
Definition at line 116 of file cccam2.c.
References i.
{
long long n=bswap_64(*(long long *)nodeid);
for(unsigned int i=0; i<16; i++) {
char final=data[i]^(n&0xFF);
if(i&1) final=~final;
data[i]=final^(shareid&0xFF);
n>>=4; shareid>>=2;
}
}
| static void cCCcamCrypt::Xor |
( |
unsigned char * |
data, |
|
|
int |
length |
|
) |
| [static] |
| void cCCcamCrypt::Xor |
( |
unsigned char * |
data, |
|
|
int |
length |
|
) |
| [static] |
The documentation for this class was generated from the following files:
- contrib/sasc-ng/sc/PLUGINS/src/sc-src/systems/cardclient/cccam2.c
- systems/cardclient/cccam2.c