Revision 2, 1.0 kB
(checked in by yumileroy, 17 years ago)
|
[svn] * Proper SVN structure
Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00
|
Line | |
---|
1 | /** |
---|
2 | @file Crypto.h |
---|
3 | |
---|
4 | @maintainer Morgan McGuire, matrix@graphics3d.com |
---|
5 | |
---|
6 | |
---|
7 | @created 2006-03-29 |
---|
8 | @edited 2006-04-06 |
---|
9 | */ |
---|
10 | |
---|
11 | #ifndef G3D_CRYPTO_H |
---|
12 | #define G3D_CRYPTO_H |
---|
13 | |
---|
14 | #include "G3D/platform.h" |
---|
15 | #include "G3D/g3dmath.h" |
---|
16 | #include <string> |
---|
17 | |
---|
18 | namespace G3D { |
---|
19 | |
---|
20 | /** Cryptography and hashing helper functions */ |
---|
21 | class Crypto { |
---|
22 | public: |
---|
23 | |
---|
24 | /** |
---|
25 | Computes the CRC32 value of a byte array. CRC32 is designed to be a hash |
---|
26 | function that produces different values for similar strings. |
---|
27 | |
---|
28 | This implementation is compatible with PKZIP and GZIP. |
---|
29 | |
---|
30 | Based on http://www.gamedev.net/reference/programming/features/crc32/ |
---|
31 | */ |
---|
32 | static uint32 crc32(const void* bytes, size_t numBytes); |
---|
33 | |
---|
34 | /** |
---|
35 | Returns the nth prime less than 2000 in constant time. The first prime has index |
---|
36 | 0 and is the number 2. |
---|
37 | */ |
---|
38 | static int smallPrime(int n); |
---|
39 | |
---|
40 | /** Returns 1 + the largest value that can be passed to smallPrime. */ |
---|
41 | static int numSmallPrimes(); |
---|
42 | }; |
---|
43 | |
---|
44 | } |
---|
45 | |
---|
46 | #endif |
---|