Annotation of truecrypt/volume/crc32.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
                      3: 
                      4:  Governed by the TrueCrypt License 2.4 the full text of which is contained
                      5:  in the file License.txt included in TrueCrypt binary and source code
                      6:  distribution packages.
                      7: */
                      8: 
                      9: #ifndef TC_HEADER_Encryption_Crc32
                     10: #define TC_HEADER_Encryption_Crc32
                     11: 
                     12: #include "Platform/Platform.h"
                     13: #include "Common/Crc.h"
                     14: 
                     15: namespace TrueCrypt
                     16: {
                     17:        class Crc32
                     18:        {
                     19:        public:
                     20:                Crc32 () : CrcValue (0xffffFFFF) { };
                     21:                virtual ~Crc32 () { };
                     22: 
                     23:                uint32 Get () const { return CrcValue ^ 0xffffFFFF; }
                     24: 
                     25:                uint32 Process (byte data)
                     26:                {
                     27:                        return CrcValue = crc_32_tab[(byte) (CrcValue ^ data)] ^ (CrcValue >> 8);
                     28:                }
                     29: 
                     30:                static uint32 ProcessBuffer (const ConstBufferPtr &buffer)
                     31:                {
                     32:                        return ::GetCrc32 (const_cast<byte *> (buffer.Get()), static_cast<int> (buffer.Size()));
                     33:                }
                     34: 
                     35:        protected:
                     36:                uint32 CrcValue;
                     37: 
                     38:        private:
                     39:                Crc32 (const Crc32 &);
                     40:                Crc32 &operator= (const Crc32 &);
                     41:        };
                     42: }
                     43: 
                     44: #endif // TC_HEADER_Encryption_Crc32

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.