Last change
on this file since 608 was
80,
checked in by Sam Hocevar, 15 years ago
|
- Adding the Golgotha source code. Not sure what's going to be interesting
in there, but since it's all public domain, there's certainly stuff to
pick up.
|
File size:
960 bytes
|
Line | |
---|
1 | /********************************************************************** <BR>
|
---|
2 | This file is part of Crack dot Com's free source code release of
|
---|
3 | Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
|
---|
4 | information about compiling & licensing issues visit this URL</a>
|
---|
5 | <PRE> If that doesn't help, contact Jonathan Clark at
|
---|
6 | golgotha_source@usa.net (Subject should have "GOLG" in it)
|
---|
7 | ***********************************************************************/
|
---|
8 |
|
---|
9 | #include "arch.hh"
|
---|
10 |
|
---|
11 | w32 i4_check_sum32(void *buf, w32 buf_len)
|
---|
12 | {
|
---|
13 | w8 c1=0,c2=0,c3=0,c4=0;
|
---|
14 | while (buf_len)
|
---|
15 | {
|
---|
16 | c1+=*((w8 *)buf);
|
---|
17 | c2+=c1;
|
---|
18 | buf=(void *)(((w8 *)buf)+1);
|
---|
19 | c3+=c2;
|
---|
20 | c4+=c3;
|
---|
21 | buf_len--;
|
---|
22 | }
|
---|
23 | return (c1|(c2<<8)|(c3<<16)|(c4<<24));
|
---|
24 | }
|
---|
25 |
|
---|
26 | w16 i4_check_sum16(void *buf, w32 buf_len)
|
---|
27 | {
|
---|
28 | w8 c1=0,c2=0;
|
---|
29 |
|
---|
30 | while (buf_len)
|
---|
31 | {
|
---|
32 | c1+=*((w8 *)buf);
|
---|
33 | buf=(void *)(((w8 *)buf)+1);
|
---|
34 | c2+=c1;
|
---|
35 | }
|
---|
36 | return (c1|(c2<<8));
|
---|
37 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.