Reference Manual
Prox–DU & Prox–SU
www.gemalto.com
DOC118569D
Public Use
Page 38/145
* (last byte on input must be the supposed CRC of the preceding bytes)
Globals :
Ressources
(Use) :
(Modify):
(Call) Internals :
Externals :
*Remarks :
*****************************************************************************/
unsigned char ucMadCrc( unsigned char _uc_len,
unsigned
char
*_puc_in,
unsigned
char
*_puc_out
)
{
unsigned char u_i;
unsigned char u_j;
unsigned char uc_status;
uc_status = ERR_OK;
*_puc_out = 0xC7; // bit-swapped 0xE3
for (u_j = 0; u_j < _uc_len; u_j++)
{
*_puc_out = *_puc_out ^ _puc_in[u_j];
for (u_i = 0; u_i < 8; u_i++)
{
if (*_puc_out & 0x80)
{
*_puc_out = (*_puc_out << 1) ^ 0x1D;
}
else
{
*_puc_out = *_puc_out << 1;
}
}
}
if (*_puc_out)
{
uc_status = ERR_MAD_CRC;
}
return (uc_status); // 0x00 if last byte is the CRC of the previous bytes
}
Summary of Contents for Prox-DU
Page 4: ......