|
|
1.1.1.6 root 1: /* Legal Notice: The source code contained in this file has been derived from
2: the source code of Encryption for the Masses 2.02a, which is Copyright (c)
3: 1998-99 Paul Le Roux and which is covered by the 'License Agreement for
4: Encryption for the Masses'. Modifications and additions to that source code
1.1.1.7 root 5: contained in this file are Copyright (c) 2004-2006 TrueCrypt Foundation and
1.1.1.8 ! root 6: Copyright (c) 2004 TrueCrypt Team, and are covered by TrueCrypt License 2.1
1.1.1.6 root 7: the full text of which is contained in the file License.txt included in
8: TrueCrypt binary and source code distribution archives. */
9:
10: #include "Tcdefs.h"
11: #include "Endian.h"
12:
13:
14: unsigned __int32 MirrorBytes32 (unsigned __int32 x)
15: {
16: unsigned __int32 n = (unsigned __int8) x;
17: n <<= 8; n |= (unsigned __int8) (x >> 8);
18: n <<= 8; n |= (unsigned __int8) (x >> 16);
19: return (n << 8) | (unsigned __int8) (x >> 24);
20: }
21:
22:
23: unsigned __int64 MirrorBytes64 (unsigned __int64 x)
24: {
25: unsigned __int64 n = (unsigned __int8) x;
26: n <<= 8; n |= (unsigned __int8) (x >> 8);
27: n <<= 8; n |= (unsigned __int8) (x >> 16);
28: n <<= 8; n |= (unsigned __int8) (x >> 24);
29: n <<= 8; n |= (unsigned __int8) (x >> 32);
30: n <<= 8; n |= (unsigned __int8) (x >> 40);
31: n <<= 8; n |= (unsigned __int8) (x >> 48);
32: return (n << 8) | (unsigned __int8) (x >> 56);
33: }
1.1 root 34:
35:
36: void
1.1.1.6 root 37: LongReverse (unsigned __int32 *buffer, unsigned byteCount)
1.1 root 38: {
1.1.1.6 root 39: unsigned __int32 value;
1.1 root 40:
1.1.1.6 root 41: byteCount /= sizeof (unsigned __int32);
1.1 root 42: while (byteCount--)
43: {
44: value = *buffer;
45: value = ((value & 0xFF00FF00L) >> 8) | \
46: ((value & 0x00FF00FFL) << 8);
47: *buffer++ = (value << 16) | (value >> 16);
48: }
49: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.