00001 // Copyright (C) 2001, Compaq Computer Corporation 00002 // 00003 // This file is part of Vesta. 00004 // 00005 // Vesta is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // Vesta is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with Vesta; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 // Last modified on Fri Nov 9 14:11:52 EST 2001 by ken@xorian.net 00020 // modified on Fri Dec 12 09:50:09 PST 1997 by heydon 00021 00022 // Poly.H -- polynomials for use by the fingerprint package 00023 00024 #ifndef _POLY_H 00025 #define _POLY_H 00026 00027 #include <Basics.H> 00028 00029 class PolyVal { 00030 public: 00031 enum { ByteCnt = 16 }; // tag bytes 00032 enum { WordCnt = ByteCnt / sizeof(Word) }; // tag words 00033 }; 00034 00035 typedef struct { 00036 Word w[PolyVal::WordCnt]; 00037 } Poly, RawFP; 00038 00039 /* The irreducible polynomial used as a modulus is 00040 1 + x^3 + x^5 + x^6 + x^7 + x^8 + x^9 + x^10 + x^17 + x^19 + x^21 + 00041 x^22 + x^23 + x^25 + x^26 + x^27 + x^30 + x^31 + x^32 + x^33 + x^35 + 00042 x^37 + x^38 + x^40 + x^41 + x^42 + x^43 + x^46 + x^47 + x^48 + x^50 + 00043 x^51 + x^52 + x^55 + x^56 + x^58 + x^59 + x^60 + x^61 + x^66 + x^68 + 00044 x^70 + x^71 + x^73 + x^75 + x^76 + x^79 + x^85 + x^86 + x^87 + x^91 + 00045 x^92 + x^95 + x^96 + x^99 + x^102 + x^103 + x^105 + x^106 + x^107 + 00046 x^108 + x^110 + x^114 + x^117 + x^119 + x^120 + x^121 + x^125 + x^126 00047 + x^127 + x^128 00048 00049 POLY_IRRED is its representation. 00050 */ 00051 00052 const Word 00053 POLY_X63_W = 0x1, 00054 POLY_ONE_W = CONST_INT_64(0x8000000000000000); 00055 00056 const Poly 00057 POLY_ZERO = {0L, 0L}, 00058 POLY_ONE = {0L, POLY_ONE_W}, 00059 POLY_IRRED = {CONST_INT_64(0x2b590719937a25c7), 00060 CONST_INT_64(0x97e05773d6f3b9bc)}; 00061 00062 inline void PolyInc(/*INOUT*/ Poly& p, const Poly& q) throw () 00063 // Equivalent to "p = p + q" 00064 { 00065 p.w[0] ^= q.w[0]; 00066 p.w[1] ^= q.w[1]; 00067 } 00068 00069 #endif // _POLY_H