From 4c10f9f00641d5826b388535bb76fc6ca6e48701 Mon Sep 17 00:00:00 2001 From: lloyd Date: Mon, 15 Oct 2007 14:47:14 +0000 Subject: Use shorter variable names in the TEA code. --- src/tea.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src') 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(in, 0), right = load_be(in, 1); + u32bit L = load_be(in, 0), R = load_be(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(in, 0), right = load_be(in, 1); + u32bit L = load_be(in, 0), R = load_be(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); } /************************************************* -- cgit v1.2.3