Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/udf/udf_cksum.c

    r5c702a8 r48e3190  
    7373};
    7474
     75/** Calculate CRC16
     76 *
     77 */
     78uint16_t udf_cksum(uint8_t *buf, size_t len)
     79{
     80        uint16_t crc = 0;
     81       
     82        while (len-- > 0)
     83                crc = crc_table[(crc >> 8 ^ *buf++) & 0xff] ^ (crc << 8);
     84       
     85        return crc;
     86}
     87
    7588/** Unicode checksum
    7689 *
     
    90103       
    91104        return crc;
     105}
     106
     107/** EA checksum
     108 *
     109 * Calculate a 16-bit checksum of the Implementation Use
     110 * Extended Attribute header or Application Use Extended Attribute
     111 * header. The fields AttributeType through ImplementationIdentifier
     112 * (or ApplicationIdentifier) inclusively represent the
     113 * data covered by the checksum (48 bytes).
     114 *
     115 */
     116uint16_t udf_ea_cksum(uint8_t *data)
     117{
     118        uint16_t checksum = 0;
     119        size_t count;
     120       
     121        for (count = 0; count < 48; count++)
     122                checksum += *data++;
     123       
     124        return checksum;
    92125}
    93126
Note: See TracChangeset for help on using the changeset viewer.