aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2007-10-15 14:47:14 +0000
committerlloyd <[email protected]>2007-10-15 14:47:14 +0000
commit4c10f9f00641d5826b388535bb76fc6ca6e48701 (patch)
tree4dafcdd350dfb5e988c8f21b6337cd7a3bb456c1
parent24519471c61aa88c38c29475901e56616b34fe44 (diff)
Use shorter variable names in the TEA code.
-rw-r--r--src/tea.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/tea.cpp b/src/tea.cpp
index aa04b1df8..cb1cac79a 100644
--- a/src/tea.cpp
+++ b/src/tea.cpp
@@ -13,17 +13,17 @@ namespace Botan {
*************************************************/
void TEA::enc(const byte in[], byte out[]) const
{
- u32bit left = load_be<u32bit>(in, 0), right = load_be<u32bit>(in, 1);
+ u32bit L = load_be<u32bit>(in, 0), R = load_be<u32bit>(in, 1);
- u32bit sum = 0;
+ u32bit S = 0;
for(u32bit j = 0; j != 32; ++j)
{
- sum += 0x9E3779B9;
- left += ((right << 4) + K[0]) ^ (right + sum) ^ ((right >> 5) + K[1]);
- right += ((left << 4) + K[2]) ^ (left + sum) ^ ((left >> 5) + K[3]);
+ S += 0x9E3779B9;
+ L += ((R << 4) + K[0]) ^ (R + S) ^ ((R >> 5) + K[1]);
+ R += ((L << 4) + K[2]) ^ (L + S) ^ ((L >> 5) + K[3]);
}
- store_be(out, left, right);
+ store_be(out, L, R);
}
/*************************************************
@@ -31,17 +31,17 @@ void TEA::enc(const byte in[], byte out[]) const
*************************************************/
void TEA::dec(const byte in[], byte out[]) const
{
- u32bit left = load_be<u32bit>(in, 0), right = load_be<u32bit>(in, 1);
+ u32bit L = load_be<u32bit>(in, 0), R = load_be<u32bit>(in, 1);
- u32bit sum = 0xC6EF3720;
+ u32bit S = 0xC6EF3720;
for(u32bit j = 0; j != 32; ++j)
{
- right -= ((left << 4) + K[2]) ^ (left + sum) ^ ((left >> 5) + K[3]);
- left -= ((right << 4) + K[0]) ^ (right + sum) ^ ((right >> 5) + K[1]);
- sum -= 0x9E3779B9;
+ R -= ((L << 4) + K[2]) ^ (L + S) ^ ((L >> 5) + K[3]);
+ L -= ((R << 4) + K[0]) ^ (R + S) ^ ((R >> 5) + K[1]);
+ S -= 0x9E3779B9;
}
- store_be(out, left, right);
+ store_be(out, L, R);
}
/*************************************************