summaryrefslogtreecommitdiff
path: root/plugins/CryptoPP/crypto/adler32.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-07-20 16:21:49 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-07-20 16:21:49 +0000
commitf424a18112032cf61d2871a6b91a5af607c171ae (patch)
tree88fedc4e28941ceecda7026f0b06eba6271f91d5 /plugins/CryptoPP/crypto/adler32.cpp
parentbfe1bd0fc087be44c70904aee0fe4276643d206d (diff)
CryptoPP:
changed folder structure git-svn-id: http://svn.miranda-ng.org/main/trunk@1083 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CryptoPP/crypto/adler32.cpp')
-rw-r--r--plugins/CryptoPP/crypto/adler32.cpp77
1 files changed, 0 insertions, 77 deletions
diff --git a/plugins/CryptoPP/crypto/adler32.cpp b/plugins/CryptoPP/crypto/adler32.cpp
deleted file mode 100644
index 227020275f..0000000000
--- a/plugins/CryptoPP/crypto/adler32.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-// adler32.cpp - written and placed in the public domain by Wei Dai
-
-#include "pch.h"
-#include "adler32.h"
-
-NAMESPACE_BEGIN(CryptoPP)
-
-void Adler32::Update(const byte *input, size_t length)
-{
- const unsigned long BASE = 65521;
-
- unsigned long s1 = m_s1;
- unsigned long s2 = m_s2;
-
- if (length % 8 != 0)
- {
- do
- {
- s1 += *input++;
- s2 += s1;
- length--;
- } while (length % 8 != 0);
-
- if (s1 >= BASE)
- s1 -= BASE;
- s2 %= BASE;
- }
-
- while (length > 0)
- {
- s1 += input[0]; s2 += s1;
- s1 += input[1]; s2 += s1;
- s1 += input[2]; s2 += s1;
- s1 += input[3]; s2 += s1;
- s1 += input[4]; s2 += s1;
- s1 += input[5]; s2 += s1;
- s1 += input[6]; s2 += s1;
- s1 += input[7]; s2 += s1;
-
- length -= 8;
- input += 8;
-
- if (s1 >= BASE)
- s1 -= BASE;
- if (length % 0x8000 == 0)
- s2 %= BASE;
- }
-
- assert(s1 < BASE);
- assert(s2 < BASE);
-
- m_s1 = (word16)s1;
- m_s2 = (word16)s2;
-}
-
-void Adler32::TruncatedFinal(byte *hash, size_t size)
-{
- ThrowIfInvalidTruncatedSize(size);
-
- switch (size)
- {
- default:
- hash[3] = byte(m_s1);
- case 3:
- hash[2] = byte(m_s1 >> 8);
- case 2:
- hash[1] = byte(m_s2);
- case 1:
- hash[0] = byte(m_s2 >> 8);
- case 0:
- ;
- }
-
- Reset();
-}
-
-NAMESPACE_END