crc32.c (113908) | crc32.c (162852) |
---|---|
1/* $OpenBSD: crc32.c,v 1.9 2003/02/12 21:39:50 markus Exp $ */ | 1/* $OpenBSD: crc32.c,v 1.11 2006/04/22 18:29:33 stevesk Exp $ */ |
2 3/* 4 * Copyright (c) 2003 Markus Friedl. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 84 unchanged lines hidden (view full) --- 94}; 95 96u_int32_t 97ssh_crc32(const u_char *buf, u_int32_t size) 98{ 99 u_int32_t i, crc; 100 101 crc = 0; | 2 3/* 4 * Copyright (c) 2003 Markus Friedl. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 84 unchanged lines hidden (view full) --- 94}; 95 96u_int32_t 97ssh_crc32(const u_char *buf, u_int32_t size) 98{ 99 u_int32_t i, crc; 100 101 crc = 0; |
102 for (i = 0; i < size; i++) | 102 for (i = 0; i < size; i++) |
103 crc = crc32tab[(crc ^ buf[i]) & 0xff] ^ (crc >> 8); 104 return crc; 105} | 103 crc = crc32tab[(crc ^ buf[i]) & 0xff] ^ (crc >> 8); 104 return crc; 105} |