Register

Welcome to the RDI-Board Community.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.


Donate Now Goal amount for this month: 100 EUR, Received: 100 EUR (100%)
Donate to support this site...

Results 1 to 1 of 1
  1. #1
    Junior Member Junior
    RDI - Board Default Avatar

    Join Date
    Oct 2007
    Posts
    3
    Posts Thanks / Likes

    Default XORING Bits in Checksum


    Holla ,


    Deseo crear una herramienta personal que calculan la suma de comprobación en mis firmware.bin, para eso i'm usando una herramienta externa de la herencia que hagan eso, yo deseo crear una herramienta personal para mi STB para hacer la suma de comprobación que éste es código generado por Legacy Tool, para ver cómo el algorythm de la suma de comprobación se hace con esta herramienta externa se hace esto es un cierto ejemplo:


    First Test :

    Actuel Checksum : BF 96 AF 63 79 B3 D4 52 ( 9 Data Bits)
    New Checksum : 85 CA 8F 67 41 44 3F B7


    2nd Test :
    Actuel Checksum : 85 CA 8F 67 41 44 3F B7 ( 9 Data Bits)
    New Checksum : F4 1B 16 36 2A 67 37 E6



    Another Test :

    Actuel Checksum : E2 0F DF 10 4B 01 51 A2
    New Checksum : 45 43 21 66 76 1F F5 FF



    My Code :

    Code:
           
    #include <string>
    
    static unsigned __intchksum CRCXX_TABLE[256];
    
    //---------------------------------------------------------------------------------------------------------------------
    unsigned __intchksum  crcXX( const void *buffer, const size_t size, unsigned __int64 crc )
    {
        if( size == 0 || !buffer )
        {
            return 0;
        }
        try
        {
            unsigned __int8 *data = (unsigned __int8 *)buffer;
            static bool init = false;
            if( !init )
            {
                init = true;
                for(int i = 0; i <= 255; i++) 
                {
                  unsigned __intXX wrd = i;
                  for( int j = 0; j < 8; j++) 
                  {
                    if( wrd & 1 )
                    {
                      wrd = (wrd >> 1) ^ crc;
                    }else
                    {
                      wrd >>= 1;
                    }
                  }
                  CRC64_TABLE[i] = wrd;
                }
            }
            for(size_t i = 0; i < size; i++, data++ ) 
            {
                unsigned __intXX t1 = crc >> 8;
                unsigned __int8 index = (unsigned __int8)((crc ^ (unsigned __int64) *data) & 0xff);
                unsigned __intXX t2 = CRCXX_TABLE[ index ];
                crc = t1 ^ t2;
            }
        }catch(...){}
        return crc;
    }
    //---------------------------------------------------------------------------------------------------------------------
    XX= CRC Type used .



    Gracias !











    __________________________________________________ _______________
    Hi ,

    I wanna create a personal tool that calculate Checksum in my firmware.bin , for that i'm using a legacy external Tool that do that , i wanna create a personal tool for my STB to do checksum this is code generated by Legacy Tool , to see how checksum algorythm is done with this external tool are done this is some example :


    First Test :

    Actuel Checksum : BF 96 AF 63 79 B3 D4 52 ( 9 Data Bits)
    New Checksum : 85 CA 8F 67 41 44 3F B7


    2nd Test :
    Actuel Checksum : 85 CA 8F 67 41 44 3F B7 ( 9 Data Bits)
    New Checksum : F4 1B 16 36 2A 67 37 E6



    Another Test :

    Actuel Checksum : E2 0F DF 10 4B 01 51 A2
    New Checksum : 45 43 21 66 76 1F F5 FF



    My Code :

    Code:
    #include <string>
    
    static unsigned __intchksum CRCXX_TABLE[256];
    
    //---------------------------------------------------------------------------------------------------------------------
    unsigned __intchksum  crcXX( const void *buffer, const size_t size, unsigned __int64 crc )
    {
        if( size == 0 || !buffer )
        {
            return 0;
        }
        try
        {
            unsigned __int8 *data = (unsigned __int8 *)buffer;
            static bool init = false;
            if( !init )
            {
                init = true;
                for(int i = 0; i <= 255; i++) 
                {
                  unsigned __intXX wrd = i;
                  for( int j = 0; j < 8; j++) 
                  {
                    if( wrd & 1 )
                    {
                      wrd = (wrd >> 1) ^ crc;
                    }else
                    {
                      wrd >>= 1;
                    }
                  }
                  CRC64_TABLE[i] = wrd;
                }
            }
            for(size_t i = 0; i < size; i++, data++ ) 
            {
                unsigned __intXX t1 = crc >> 8;
                unsigned __int8 index = (unsigned __int8)((crc ^ (unsigned __int64) *data) & 0xff);
                unsigned __intXX t2 = CRCXX_TABLE[ index ];
                crc = t1 ^ t2;
            }
        }catch(...){}
        return crc;
    }
    //---------------------------------------------------------------------------------------------------------------------

    XX= CRC Type used .




    Thank's for any advice wish could help me .
    Last edited by Luciano; 5th October 2007 at 06:56.

 

 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Back to Top