summaryrefslogtreecommitdiffstats
path: root/old/botan/src/checksum
diff options
context:
space:
mode:
Diffstat (limited to 'old/botan/src/checksum')
-rw-r--r--old/botan/src/checksum/adler32/adler32.cpp74
-rw-r--r--old/botan/src/checksum/adler32/adler32.h35
-rw-r--r--old/botan/src/checksum/adler32/info.txt14
-rw-r--r--old/botan/src/checksum/crc24/crc24.cpp100
-rw-r--r--old/botan/src/checksum/crc24/crc24.h34
-rw-r--r--old/botan/src/checksum/crc24/info.txt14
-rw-r--r--old/botan/src/checksum/crc32/crc32.cpp102
-rw-r--r--old/botan/src/checksum/crc32/crc32.h34
-rw-r--r--old/botan/src/checksum/crc32/info.txt14
9 files changed, 421 insertions, 0 deletions
diff --git a/old/botan/src/checksum/adler32/adler32.cpp b/old/botan/src/checksum/adler32/adler32.cpp
new file mode 100644
index 0000000..c66943b
--- /dev/null
+++ b/old/botan/src/checksum/adler32/adler32.cpp
@@ -0,0 +1,74 @@
+/*
+* Adler32
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#include <botan/adler32.h>
+#include <botan/loadstor.h>
+
+namespace Botan {
+
+/*
+* Adler32 Checksum
+*/
+void Adler32::hash(const byte input[], u32bit length)
+ {
+ u32bit S1x = S1, S2x = S2;
+ while(length >= 16)
+ {
+ S1x += input[ 0]; S2x += S1x;
+ S1x += input[ 1]; S2x += S1x;
+ S1x += input[ 2]; S2x += S1x;
+ S1x += input[ 3]; S2x += S1x;
+ S1x += input[ 4]; S2x += S1x;
+ S1x += input[ 5]; S2x += S1x;
+ S1x += input[ 6]; S2x += S1x;
+ S1x += input[ 7]; S2x += S1x;
+ S1x += input[ 8]; S2x += S1x;
+ S1x += input[ 9]; S2x += S1x;
+ S1x += input[10]; S2x += S1x;
+ S1x += input[11]; S2x += S1x;
+ S1x += input[12]; S2x += S1x;
+ S1x += input[13]; S2x += S1x;
+ S1x += input[14]; S2x += S1x;
+ S1x += input[15]; S2x += S1x;
+ input += 16;
+ length -= 16;
+ }
+ for(u32bit j = 0; j != length; ++j)
+ {
+ S1x += input[j]; S2x += S1x;
+ }
+ S1x %= 65521;
+ S2x %= 65521;
+ S1 = S1x;
+ S2 = S2x;
+ }
+
+/*
+* Update an Adler32 Checksum
+*/
+void Adler32::add_data(const byte input[], u32bit length)
+ {
+ const u32bit PROCESS_AMOUNT = 5552;
+ while(length >= PROCESS_AMOUNT)
+ {
+ hash(input, PROCESS_AMOUNT);
+ input += PROCESS_AMOUNT;
+ length -= PROCESS_AMOUNT;
+ }
+ hash(input, length);
+ }
+
+/*
+* Finalize an Adler32 Checksum
+*/
+void Adler32::final_result(byte output[])
+ {
+ store_be(output, S2, S1);
+ clear();
+ }
+
+}
diff --git a/old/botan/src/checksum/adler32/adler32.h b/old/botan/src/checksum/adler32/adler32.h
new file mode 100644
index 0000000..98a28bc
--- /dev/null
+++ b/old/botan/src/checksum/adler32/adler32.h
@@ -0,0 +1,35 @@
+/*
+* Adler32
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#ifndef BOTAN_ADLER32_H__
+#define BOTAN_ADLER32_H__
+
+#include <botan/hash.h>
+
+namespace Botan {
+
+/*
+* Adler32
+*/
+class BOTAN_DLL Adler32 : public HashFunction
+ {
+ public:
+ void clear() throw() { S1 = 1; S2 = 0; }
+ std::string name() const { return "Adler32"; }
+ HashFunction* clone() const { return new Adler32; }
+ Adler32() : HashFunction(4) { clear(); }
+ ~Adler32() { clear(); }
+ private:
+ void add_data(const byte[], u32bit);
+ void final_result(byte[]);
+ void hash(const byte[], u32bit);
+ u16bit S1, S2;
+ };
+
+}
+
+#endif
diff --git a/old/botan/src/checksum/adler32/info.txt b/old/botan/src/checksum/adler32/info.txt
new file mode 100644
index 0000000..76662cd
--- /dev/null
+++ b/old/botan/src/checksum/adler32/info.txt
@@ -0,0 +1,14 @@
+realname "Adler32"
+
+define ADLER32
+
+load_on auto
+
+<add>
+adler32.cpp
+adler32.h
+</add>
+
+<requires>
+hash
+</requires>
diff --git a/old/botan/src/checksum/crc24/crc24.cpp b/old/botan/src/checksum/crc24/crc24.cpp
new file mode 100644
index 0000000..e50b4d3
--- /dev/null
+++ b/old/botan/src/checksum/crc24/crc24.cpp
@@ -0,0 +1,100 @@
+/*
+* CRC24
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#include <botan/crc24.h>
+#include <botan/loadstor.h>
+
+namespace Botan {
+
+/*
+* Update a CRC24 Checksum
+*/
+void CRC24::add_data(const byte input[], u32bit length)
+ {
+ const u32bit TABLE[256] = {
+ 0x00000000, 0x00864CFB, 0x008AD50D, 0x000C99F6, 0x0093E6E1, 0x0015AA1A,
+ 0x001933EC, 0x009F7F17, 0x00A18139, 0x0027CDC2, 0x002B5434, 0x00AD18CF,
+ 0x003267D8, 0x00B42B23, 0x00B8B2D5, 0x003EFE2E, 0x00C54E89, 0x00430272,
+ 0x004F9B84, 0x00C9D77F, 0x0056A868, 0x00D0E493, 0x00DC7D65, 0x005A319E,
+ 0x0064CFB0, 0x00E2834B, 0x00EE1ABD, 0x00685646, 0x00F72951, 0x007165AA,
+ 0x007DFC5C, 0x00FBB0A7, 0x000CD1E9, 0x008A9D12, 0x008604E4, 0x0000481F,
+ 0x009F3708, 0x00197BF3, 0x0015E205, 0x0093AEFE, 0x00AD50D0, 0x002B1C2B,
+ 0x002785DD, 0x00A1C926, 0x003EB631, 0x00B8FACA, 0x00B4633C, 0x00322FC7,
+ 0x00C99F60, 0x004FD39B, 0x00434A6D, 0x00C50696, 0x005A7981, 0x00DC357A,
+ 0x00D0AC8C, 0x0056E077, 0x00681E59, 0x00EE52A2, 0x00E2CB54, 0x006487AF,
+ 0x00FBF8B8, 0x007DB443, 0x00712DB5, 0x00F7614E, 0x0019A3D2, 0x009FEF29,
+ 0x009376DF, 0x00153A24, 0x008A4533, 0x000C09C8, 0x0000903E, 0x0086DCC5,
+ 0x00B822EB, 0x003E6E10, 0x0032F7E6, 0x00B4BB1D, 0x002BC40A, 0x00AD88F1,
+ 0x00A11107, 0x00275DFC, 0x00DCED5B, 0x005AA1A0, 0x00563856, 0x00D074AD,
+ 0x004F0BBA, 0x00C94741, 0x00C5DEB7, 0x0043924C, 0x007D6C62, 0x00FB2099,
+ 0x00F7B96F, 0x0071F594, 0x00EE8A83, 0x0068C678, 0x00645F8E, 0x00E21375,
+ 0x0015723B, 0x00933EC0, 0x009FA736, 0x0019EBCD, 0x008694DA, 0x0000D821,
+ 0x000C41D7, 0x008A0D2C, 0x00B4F302, 0x0032BFF9, 0x003E260F, 0x00B86AF4,
+ 0x002715E3, 0x00A15918, 0x00ADC0EE, 0x002B8C15, 0x00D03CB2, 0x00567049,
+ 0x005AE9BF, 0x00DCA544, 0x0043DA53, 0x00C596A8, 0x00C90F5E, 0x004F43A5,
+ 0x0071BD8B, 0x00F7F170, 0x00FB6886, 0x007D247D, 0x00E25B6A, 0x00641791,
+ 0x00688E67, 0x00EEC29C, 0x003347A4, 0x00B50B5F, 0x00B992A9, 0x003FDE52,
+ 0x00A0A145, 0x0026EDBE, 0x002A7448, 0x00AC38B3, 0x0092C69D, 0x00148A66,
+ 0x00181390, 0x009E5F6B, 0x0001207C, 0x00876C87, 0x008BF571, 0x000DB98A,
+ 0x00F6092D, 0x007045D6, 0x007CDC20, 0x00FA90DB, 0x0065EFCC, 0x00E3A337,
+ 0x00EF3AC1, 0x0069763A, 0x00578814, 0x00D1C4EF, 0x00DD5D19, 0x005B11E2,
+ 0x00C46EF5, 0x0042220E, 0x004EBBF8, 0x00C8F703, 0x003F964D, 0x00B9DAB6,
+ 0x00B54340, 0x00330FBB, 0x00AC70AC, 0x002A3C57, 0x0026A5A1, 0x00A0E95A,
+ 0x009E1774, 0x00185B8F, 0x0014C279, 0x00928E82, 0x000DF195, 0x008BBD6E,
+ 0x00872498, 0x00016863, 0x00FAD8C4, 0x007C943F, 0x00700DC9, 0x00F64132,
+ 0x00693E25, 0x00EF72DE, 0x00E3EB28, 0x0065A7D3, 0x005B59FD, 0x00DD1506,
+ 0x00D18CF0, 0x0057C00B, 0x00C8BF1C, 0x004EF3E7, 0x00426A11, 0x00C426EA,
+ 0x002AE476, 0x00ACA88D, 0x00A0317B, 0x00267D80, 0x00B90297, 0x003F4E6C,
+ 0x0033D79A, 0x00B59B61, 0x008B654F, 0x000D29B4, 0x0001B042, 0x0087FCB9,
+ 0x001883AE, 0x009ECF55, 0x009256A3, 0x00141A58, 0x00EFAAFF, 0x0069E604,
+ 0x00657FF2, 0x00E33309, 0x007C4C1E, 0x00FA00E5, 0x00F69913, 0x0070D5E8,
+ 0x004E2BC6, 0x00C8673D, 0x00C4FECB, 0x0042B230, 0x00DDCD27, 0x005B81DC,
+ 0x0057182A, 0x00D154D1, 0x0026359F, 0x00A07964, 0x00ACE092, 0x002AAC69,
+ 0x00B5D37E, 0x00339F85, 0x003F0673, 0x00B94A88, 0x0087B4A6, 0x0001F85D,
+ 0x000D61AB, 0x008B2D50, 0x00145247, 0x00921EBC, 0x009E874A, 0x0018CBB1,
+ 0x00E37B16, 0x006537ED, 0x0069AE1B, 0x00EFE2E0, 0x00709DF7, 0x00F6D10C,
+ 0x00FA48FA, 0x007C0401, 0x0042FA2F, 0x00C4B6D4, 0x00C82F22, 0x004E63D9,
+ 0x00D11CCE, 0x00575035, 0x005BC9C3, 0x00DD8538 };
+
+ u32bit tmp = crc;
+ while(length >= 16)
+ {
+ tmp = TABLE[((tmp >> 16) ^ input[ 0]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[ 1]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[ 2]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[ 3]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[ 4]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[ 5]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[ 6]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[ 7]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[ 8]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[ 9]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[10]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[11]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[12]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[13]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[14]) & 0xFF] ^ (tmp << 8);
+ tmp = TABLE[((tmp >> 16) ^ input[15]) & 0xFF] ^ (tmp << 8);
+ input += 16;
+ length -= 16;
+ }
+ for(u32bit j = 0; j != length; ++j)
+ tmp = TABLE[((tmp >> 16) ^ input[j]) & 0xFF] ^ (tmp << 8);
+ crc = tmp;
+ }
+
+/*
+* Finalize a CRC24 Checksum
+*/
+void CRC24::final_result(byte output[])
+ {
+ for(u32bit j = 0; j != 3; ++j)
+ output[j] = get_byte(j+1, crc);
+ clear();
+ }
+
+}
diff --git a/old/botan/src/checksum/crc24/crc24.h b/old/botan/src/checksum/crc24/crc24.h
new file mode 100644
index 0000000..bca4d0e
--- /dev/null
+++ b/old/botan/src/checksum/crc24/crc24.h
@@ -0,0 +1,34 @@
+/*
+* CRC24
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#ifndef BOTAN_CRC24_H__
+#define BOTAN_CRC24_H__
+
+#include <botan/hash.h>
+
+namespace Botan {
+
+/*
+* CRC24
+*/
+class BOTAN_DLL CRC24 : public HashFunction
+ {
+ public:
+ void clear() throw() { crc = 0xB704CE; }
+ std::string name() const { return "CRC24"; }
+ HashFunction* clone() const { return new CRC24; }
+ CRC24() : HashFunction(3) { clear(); }
+ ~CRC24() { clear(); }
+ private:
+ void add_data(const byte[], u32bit);
+ void final_result(byte[]);
+ u32bit crc;
+ };
+
+}
+
+#endif
diff --git a/old/botan/src/checksum/crc24/info.txt b/old/botan/src/checksum/crc24/info.txt
new file mode 100644
index 0000000..33b86a9
--- /dev/null
+++ b/old/botan/src/checksum/crc24/info.txt
@@ -0,0 +1,14 @@
+realname "CRC-24"
+
+define CRC24
+
+load_on auto
+
+<add>
+crc24.cpp
+crc24.h
+</add>
+
+<requires>
+hash
+</requires>
diff --git a/old/botan/src/checksum/crc32/crc32.cpp b/old/botan/src/checksum/crc32/crc32.cpp
new file mode 100644
index 0000000..4246209
--- /dev/null
+++ b/old/botan/src/checksum/crc32/crc32.cpp
@@ -0,0 +1,102 @@
+/*
+* CRC32
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#include <botan/crc32.h>
+#include <botan/loadstor.h>
+
+namespace Botan {
+
+/*
+* Update a CRC32 Checksum
+*/
+void CRC32::add_data(const byte input[], u32bit length)
+ {
+ const u32bit TABLE[256] = {
+ 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F,
+ 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
+ 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2,
+ 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
+ 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,
+ 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
+ 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C,
+ 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
+ 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423,
+ 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
+ 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106,
+ 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
+ 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D,
+ 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
+ 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,
+ 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
+ 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7,
+ 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
+ 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA,
+ 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
+ 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
+ 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
+ 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84,
+ 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
+ 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,
+ 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
+ 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E,
+ 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
+ 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55,
+ 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
+ 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28,
+ 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
+ 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F,
+ 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
+ 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242,
+ 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
+ 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69,
+ 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
+ 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC,
+ 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
+ 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693,
+ 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
+ 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D };
+
+ u32bit tmp = crc;
+ while(length >= 16)
+ {
+ tmp = TABLE[(tmp ^ input[ 0]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[ 1]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[ 2]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[ 3]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[ 4]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[ 5]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[ 6]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[ 7]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[ 8]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[ 9]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[10]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[11]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[12]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[13]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[14]) & 0xFF] ^ (tmp >> 8);
+ tmp = TABLE[(tmp ^ input[15]) & 0xFF] ^ (tmp >> 8);
+ input += 16;
+ length -= 16;
+ }
+
+ for(u32bit j = 0; j != length; ++j)
+ tmp = TABLE[(tmp ^ input[j]) & 0xFF] ^ (tmp >> 8);
+
+ crc = tmp;
+ }
+
+/*
+* Finalize a CRC32 Checksum
+*/
+void CRC32::final_result(byte output[])
+ {
+ crc ^= 0xFFFFFFFF;
+ store_be(crc, output);
+ clear();
+ }
+
+}
diff --git a/old/botan/src/checksum/crc32/crc32.h b/old/botan/src/checksum/crc32/crc32.h
new file mode 100644
index 0000000..390fb10
--- /dev/null
+++ b/old/botan/src/checksum/crc32/crc32.h
@@ -0,0 +1,34 @@
+/*
+* CRC32
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#ifndef BOTAN_CRC32_H__
+#define BOTAN_CRC32_H__
+
+#include <botan/hash.h>
+
+namespace Botan {
+
+/*
+* CRC32
+*/
+class BOTAN_DLL CRC32 : public HashFunction
+ {
+ public:
+ void clear() throw() { crc = 0xFFFFFFFF; }
+ std::string name() const { return "CRC32"; }
+ HashFunction* clone() const { return new CRC32; }
+ CRC32() : HashFunction(4) { clear(); }
+ ~CRC32() { clear(); }
+ private:
+ void add_data(const byte[], u32bit);
+ void final_result(byte[]);
+ u32bit crc;
+ };
+
+}
+
+#endif
diff --git a/old/botan/src/checksum/crc32/info.txt b/old/botan/src/checksum/crc32/info.txt
new file mode 100644
index 0000000..15933b3
--- /dev/null
+++ b/old/botan/src/checksum/crc32/info.txt
@@ -0,0 +1,14 @@
+realname "CRC-32"
+
+define CRC32
+
+load_on auto
+
+<add>
+crc32.cpp
+crc32.h
+</add>
+
+<requires>
+hash
+</requires>