Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

md5.h

Go to the documentation of this file.
00001 /*
00002 MobileRobots Advanced Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004, 2005 ActivMedia Robotics LLC
00004 Copyright (C) 2006, 2007 MobileRobots Inc.
00005 
00006      This program is free software; you can redistribute it and/or modify
00007      it under the terms of the GNU General Public License as published by
00008      the Free Software Foundation; either version 2 of the License, or
00009      (at your option) any later version.
00010 
00011      This program is distributed in the hope that it will be useful,
00012      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014      GNU General Public License for more details.
00015 
00016      You should have received a copy of the GNU General Public License
00017      along with this program; if not, write to the Free Software
00018      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 If you wish to redistribute ARIA under different terms, contact 
00021 MobileRobots for information about a commercial version of ARIA at 
00022 robots@mobilerobots.com or 
00023 MobileRobots Inc, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
00024 */
00025 
00026 /*
00027   This is the software we use for doing the md5 checksums, its from 
00028   http://sourceforge.net/project/showfiles.php?group_id=42360
00029 */
00030 
00031 /*
00032   Copyright (C) 1999, 2002 Aladdin Enterprises.  All rights reserved.
00033 
00034   This software is provided 'as-is', without any express or implied
00035   warranty.  In no event will the authors be held liable for any damages
00036   arising from the use of this software.
00037 
00038   Permission is granted to anyone to use this software for any purpose,
00039   including commercial applications, and to alter it and redistribute it
00040   freely, subject to the following restrictions:
00041 
00042   1. The origin of this software must not be misrepresented; you must not
00043      claim that you wrote the original software. If you use this software
00044      in a product, an acknowledgment in the product documentation would be
00045      appreciated but is not required.
00046   2. Altered source versions must be plainly marked as such, and must not be
00047      misrepresented as being the original software.
00048   3. This notice may not be removed or altered from any source distribution.
00049 
00050   L. Peter Deutsch
00051   ghost@aladdin.com
00052 
00053  */
00054 /*
00055   Independent implementation of MD5 (RFC 1321).
00056 
00057   This code implements the MD5 Algorithm defined in RFC 1321, whose
00058   text is available at
00059         http://www.ietf.org/rfc/rfc1321.txt
00060   The code is derived from the text of the RFC, including the test suite
00061   (section A.5) but excluding the rest of Appendix A.  It does not include
00062   any code or documentation that is identified in the RFC as being
00063   copyrighted.
00064 
00065   The original and principal author of md5.h is L. Peter Deutsch
00066   <ghost@aladdin.com>.  Other authors are noted in the change history
00067   that follows (in reverse chronological order):
00068 
00069   2002-04-13 lpd Removed support for non-ANSI compilers; removed
00070         references to Ghostscript; clarified derivation from RFC 1321;
00071         now handles byte order either statically or dynamically.
00072   1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
00073   1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
00074         added conditionalization for C++ compilation from Martin
00075         Purschke <purschke@bnl.gov>.
00076   1999-05-03 lpd Original version.
00077  */
00078 
00079 #ifndef md5_INCLUDED
00080 #  define md5_INCLUDED
00081 
00082 /*
00083  * This package supports both compile-time and run-time determination of CPU
00084  * byte order.  If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be
00085  * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is
00086  * defined as non-zero, the code will be compiled to run only on big-endian
00087  * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to
00088  * run on either big- or little-endian CPUs, but will run slightly less
00089  * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined.
00090  */
00091 
00092 typedef unsigned char md5_byte_t; /* 8-bit byte */
00093 typedef unsigned int md5_word_t; /* 32-bit word */
00094 
00095 /* Define the state of the MD5 Algorithm. */
00096 typedef struct md5_state_s {
00097     md5_word_t count[2];        /* message length in bits, lsw first */
00098     md5_word_t abcd[4];         /* digest buffer */
00099     md5_byte_t buf[64];         /* accumulate block */
00100 } md5_state_t;
00101 
00102 // MPL (ActivMedia) taking out the extern since its only being used in c++
00103 /*
00104 #ifdef __cplusplus
00105 extern "C" 
00106 {
00107 #endif
00108 */
00109 
00110 // RH (ActivMedia/MobileRobots) Added "AREXPORT" symbol to all public functions. On Windows, this must be defined
00111 // to either import or export the symbols to/from DLLs. On other platforms, it should be defined to be nothing.
00112 
00113 /* Initialize the algorithm. */
00114 AREXPORT void md5_init(md5_state_t *pms);
00115 
00116 /* Append a string to the message. */
00117 AREXPORT void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
00118 
00119 /* Finish the message and return the digest. */
00120 AREXPORT void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
00121 
00123 /*
00124 #ifdef __cplusplus
00125 }  // end extern "C"
00126 #endif
00127 */
00128 
00129 #endif /* md5_INCLUDED */

Generated on Tue Feb 20 10:51:50 2007 for ArNetworking by  doxygen 1.4.0