aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-02-14 18:25:27 +0000
committerlloyd <[email protected]>2011-02-14 18:25:27 +0000
commit833d6802b30c86ad48c14edae6850706cd63030d (patch)
tree8b2b9c469b601b18727491434bbfbb1a3bfb3aea /src
parentd6b0aac85b1780c6e5827e026161df1a74620e42 (diff)
Const variables where possible
Diffstat (limited to 'src')
-rw-r--r--src/block/mars/mars.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/block/mars/mars.cpp b/src/block/mars/mars.cpp
index 5ee5b0f19..171ce2945 100644
--- a/src/block/mars/mars.cpp
+++ b/src/block/mars/mars.cpp
@@ -110,7 +110,7 @@ const u32bit SBOX[512] = {
inline void encrypt_round(u32bit& A, u32bit& B, u32bit& C, u32bit& D,
u32bit EK1, u32bit EK2)
{
- u32bit X = A + EK1;
+ const u32bit X = A + EK1;
A = rotate_left(A, 13);
u32bit Y = A * EK2;
u32bit Z = SBOX[X % 512];
@@ -132,7 +132,7 @@ inline void decrypt_round(u32bit& A, u32bit& B, u32bit& C, u32bit& D,
{
u32bit Y = A * EK1;
A = rotate_right(A, 13);
- u32bit X = A + EK2;
+ const u32bit X = A + EK2;
u32bit Z = SBOX[X % 512];
Y = rotate_left(Y, 5);
@@ -204,7 +204,7 @@ u32bit gen_mask(u32bit input)
for(u32bit j = 2; j != 31; ++j)
{
- u32bit region = (input >> (j-1)) & 0x07;
+ const u32bit region = (input >> (j-1)) & 0x07;
if(region == 0x00 || region == 0x07)
{
@@ -213,7 +213,7 @@ u32bit gen_mask(u32bit input)
for(u32bit k = low; k != high; ++k)
{
- u32bit value = (input >> k) & 0x3FF;
+ const u32bit value = (input >> k) & 0x3FF;
if(value == 0 || value == 0x3FF)
{
@@ -377,7 +377,7 @@ void MARS::key_schedule(const byte key[], size_t length)
for(size_t i = 5; i != 37; i += 2)
{
- u32bit key3 = EK[i] & 3;
+ const u32bit key3 = EK[i] & 3;
EK[i] |= 3;
EK[i] ^= rotate_left(SBOX[265 + key3], EK[i-1] % 32) & gen_mask(EK[i]);
}