/[dtapublic]/projs/dtats/trunk/shared_source/c_datd/crchashfuncs.h
ViewVC logotype

Annotation of /projs/dtats/trunk/shared_source/c_datd/crchashfuncs.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 98 - (hide annotations) (download)
Sun Dec 18 00:57:31 2016 UTC (7 years, 9 months ago) by dashley
File MIME type: text/plain
File size: 4130 byte(s)
Reorganization.
1 dashley 71 //$Header$
2     //-------------------------------------------------------------------------------------------------
3     //This file is part of "David T. Ashley's Shared Source Code", a set of shared components
4     //integrated into many of David T. Ashley's projects.
5     //-------------------------------------------------------------------------------------------------
6     //This source code and any program in which it is compiled/used is provided under the MIT License,
7     //reproduced below.
8     //-------------------------------------------------------------------------------------------------
9     //Permission is hereby granted, free of charge, to any person obtaining a copy of
10     //this software and associated documentation files(the "Software"), to deal in the
11     //Software without restriction, including without limitation the rights to use,
12     //copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the
13     //Software, and to permit persons to whom the Software is furnished to do so,
14     //subject to the following conditions :
15     //
16     //The above copyright notice and this permission notice shall be included in all
17     //copies or substantial portions of the Software.
18     //
19     //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20     //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21     //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
22     //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23     //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24     //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25     //SOFTWARE.
26     //-------------------------------------------------------------------------------------------------
27     //This software module is concerned with functions to support the generation
28     //of CRCs and hash functions. CRCs and hash functions are similar in that they
29     //provide an abstraction of a large amount of data, although CRCs may have better
30     //(or different) statistical properties than hash functions. These functions
31     //are split out from any specific application for maximum reusability of the
32     //code.
33    
34     #ifndef CRCHASHFUNCS_H_INCLUDED
35     #define CRCHASHFUNCS_H_INCLUDED
36    
37     #ifdef MODULE_CRCHASHFUNCS
38     #define DECMOD_CRCHASHFUNCS
39     #else
40     #define DECMOD_CRCHASHFUNCS extern
41     #endif
42    
43     //Define the state object that holds CRC-32 intermediate results as the CRC is
44     //being formed. This is conceptually private for the caller.
45     //
46     struct CRCHASHFUNCS_Crc32StateStruct
47     {
48     unsigned crc;
49     //This is the only state for now.
50     };
51    
52     //All CRC32 functions are courtesy of Richard A. Ellingson
53     //from the Internet.
54     //
55     //Checks the CRC-32 table for integrity, returns non-zero if
56     //the table is OK, or 0 if the table is corrupted. The table
57     //is a table of constants in memory--it is not known how
58     //much protection the "const" keyword can give it, i.e. if
59     //the tools can put it in a memory segment where some kind
60     //of protection is afforded by the OS.
61     DECMOD_CRCHASHFUNCS
62     int CRCHASHFUNCS_Crc32TableCheck(void);
63    
64     //Initializes the CRC formation structure.
65     DECMOD_CRCHASHFUNCS
66     void CRCHASHFUNCS_Crc32StateStructOpen(struct CRCHASHFUNCS_Crc32StateStruct *arg);
67    
68     //Adds data to it.
69     DECMOD_CRCHASHFUNCS
70     void CRCHASHFUNCS_Crc32StateStructAddData(struct CRCHASHFUNCS_Crc32StateStruct *arg,
71     void *data,
72     unsigned len);
73    
74     //Reads the CRC out at any time.
75     DECMOD_CRCHASHFUNCS
76     unsigned CRCHASHFUNCS_Crc32Extract(struct CRCHASHFUNCS_Crc32StateStruct *arg);
77    
78     //Closes the structure.
79     DECMOD_CRCHASHFUNCS
80     void CRCHASHFUNCS_Crc32StateStructClose(struct CRCHASHFUNCS_Crc32StateStruct *arg);
81    
82     DECMOD_CRCHASHFUNCS const char *CRCHASHFUNCS_cvcinfo(void);
83     DECMOD_CRCHASHFUNCS const char *CRCHASHFUNCS_hvcinfo(void);
84    
85     //Definition of the version of the H file, used for providing version control
86     //information to external callers.
87     #define CRCHASHFUNCS_H_VERSION ("$Header$")
88     #endif
89    
90     //End of crchashfuncs.h.

Properties

Name Value
svn:eol-style native
svn:keywords Header

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25