summaryrefslogtreecommitdiff
path: root/cryptopp/crypto/words.h
diff options
context:
space:
mode:
authorwatcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-11-26 14:19:43 +0000
committerwatcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-11-26 14:19:43 +0000
commit7aff1e4cb053394db57c2814d5fe1e6493e0cc75 (patch)
treec8585e44049b37e4da152495c954242204c2c38d /cryptopp/crypto/words.h
parent6f3d69266933ef120d229e0daf2da164b77214d0 (diff)
Project folders rename part 2
git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@214 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'cryptopp/crypto/words.h')
-rw-r--r--cryptopp/crypto/words.h103
1 files changed, 0 insertions, 103 deletions
diff --git a/cryptopp/crypto/words.h b/cryptopp/crypto/words.h
deleted file mode 100644
index f76e849..0000000
--- a/cryptopp/crypto/words.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef CRYPTOPP_WORDS_H
-#define CRYPTOPP_WORDS_H
-
-#include "misc.h"
-
-NAMESPACE_BEGIN(CryptoPP)
-
-inline size_t CountWords(const word *X, size_t N)
-{
- while (N && X[N-1]==0)
- N--;
- return N;
-}
-
-inline void SetWords(word *r, word a, size_t n)
-{
- for (size_t i=0; i<n; i++)
- r[i] = a;
-}
-
-inline void CopyWords(word *r, const word *a, size_t n)
-{
- if (r != a)
- memcpy(r, a, n*WORD_SIZE);
-}
-
-inline void XorWords(word *r, const word *a, const word *b, size_t n)
-{
- for (size_t i=0; i<n; i++)
- r[i] = a[i] ^ b[i];
-}
-
-inline void XorWords(word *r, const word *a, size_t n)
-{
- for (size_t i=0; i<n; i++)
- r[i] ^= a[i];
-}
-
-inline void AndWords(word *r, const word *a, const word *b, size_t n)
-{
- for (size_t i=0; i<n; i++)
- r[i] = a[i] & b[i];
-}
-
-inline void AndWords(word *r, const word *a, size_t n)
-{
- for (size_t i=0; i<n; i++)
- r[i] &= a[i];
-}
-
-inline word ShiftWordsLeftByBits(word *r, size_t n, unsigned int shiftBits)
-{
- assert (shiftBits<WORD_BITS);
- word u, carry=0;
- if (shiftBits)
- for (size_t i=0; i<n; i++)
- {
- u = r[i];
- r[i] = (u << shiftBits) | carry;
- carry = u >> (WORD_BITS-shiftBits);
- }
- return carry;
-}
-
-inline word ShiftWordsRightByBits(word *r, size_t n, unsigned int shiftBits)
-{
- assert (shiftBits<WORD_BITS);
- word u, carry=0;
- if (shiftBits)
- for (size_t i=n; i>0; i--)
- {
- u = r[i-1];
- r[i-1] = (u >> shiftBits) | carry;
- carry = u << (WORD_BITS-shiftBits);
- }
- return carry;
-}
-
-inline void ShiftWordsLeftByWords(word *r, size_t n, size_t shiftWords)
-{
- shiftWords = STDMIN(shiftWords, n);
- if (shiftWords)
- {
- for (size_t i=n-1; i>=shiftWords; i--)
- r[i] = r[i-shiftWords];
- SetWords(r, 0, shiftWords);
- }
-}
-
-inline void ShiftWordsRightByWords(word *r, size_t n, size_t shiftWords)
-{
- shiftWords = STDMIN(shiftWords, n);
- if (shiftWords)
- {
- for (size_t i=0; i+shiftWords<n; i++)
- r[i] = r[i+shiftWords];
- SetWords(r+n-shiftWords, 0, shiftWords);
- }
-}
-
-NAMESPACE_END
-
-#endif