Support functions for word operations.
More...
#include "config.h"
#include "misc.h"
Go to the source code of this file.
|
size_t | CountWords (const word *x, size_t n) |
| Count the number of words.
|
|
void | SetWords (word *r, word a, size_t n) |
| Set the value of words.
|
|
void | CopyWords (word *r, const word *a, size_t n) |
| Copy word array.
|
|
void | XorWords (word *r, const word *a, const word *b, size_t n) |
| XOR word arrays.
|
|
void | XorWords (word *r, const word *a, size_t n) |
| XOR word arrays.
|
|
void | AndWords (word *r, const word *a, const word *b, size_t n) |
| AND word arrays.
|
|
void | AndWords (word *r, const word *a, size_t n) |
| AND word arrays.
|
|
void | OrWords (word *r, const word *a, const word *b, size_t n) |
| OR word arrays.
|
|
void | OrWords (word *r, const word *a, size_t n) |
| OR word arrays.
|
|
word | ShiftWordsLeftByBits (word *r, size_t n, unsigned int shiftBits) |
| Left shift word array.
|
|
word | ShiftWordsRightByBits (word *r, size_t n, unsigned int shiftBits) |
| Right shift word array.
|
|
void | ShiftWordsLeftByWords (word *r, size_t n, size_t shiftWords) |
| Left shift word array.
|
|
void | ShiftWordsRightByWords (word *r, size_t n, size_t shiftWords) |
| Right shift word array.
|
|
Support functions for word operations.
Definition in file words.h.
◆ AndWords() [1/2]
void AndWords |
( |
word * |
r, |
|
|
const word * |
a, |
|
|
const word * |
b, |
|
|
size_t |
n |
|
) |
| |
|
inline |
AND word arrays.
- Parameters
-
r | destination word array |
a | first source word array |
b | second source word array |
n | size of the word array, in elements |
AndWords ANDs the two source word arrays and copies the result to the destination word array.
- Since
- Crypto++ 1.0
Definition at line 93 of file words.h.
◆ AndWords() [2/2]
void AndWords |
( |
word * |
r, |
|
|
const word * |
a, |
|
|
size_t |
n |
|
) |
| |
|
inline |
AND word arrays.
- Parameters
-
r | destination word array |
a | source word array |
n | size of the word array, in elements |
AndWords ANDs the source word array with the destination word array.
- Since
- Crypto++ 1.0
Definition at line 106 of file words.h.
◆ CopyWords()
void CopyWords |
( |
word * |
r, |
|
|
const word * |
a, |
|
|
size_t |
n |
|
) |
| |
|
inline |
Copy word array.
- Parameters
-
r | destination word array |
a | source word array |
n | size of the word array, in elements |
CopyWords copies the source word array to the destination word array.
- Since
- Crypto++ 1.0
Definition at line 48 of file words.h.
◆ CountWords()
size_t CountWords |
( |
const word * |
x, |
|
|
size_t |
n |
|
) |
| |
|
inline |
Count the number of words.
- Parameters
-
x | word array |
n | size of the word array, in elements |
- Returns
- number of words used in the array.
CountWords counts the number of words in a word array. Leading 0-words are not included in the count.
- Since
- Crypto++ 1.0
Definition at line 21 of file words.h.
◆ OrWords() [1/2]
void OrWords |
( |
word * |
r, |
|
|
const word * |
a, |
|
|
const word * |
b, |
|
|
size_t |
n |
|
) |
| |
|
inline |
OR word arrays.
- Parameters
-
r | destination word array |
a | first source word array |
b | second source word array |
n | size of the word array, in elements |
OrWords ORs the two source word arrays and copies the result to the destination word array.
- Since
- Crypto++ 1.0
Definition at line 120 of file words.h.
◆ OrWords() [2/2]
void OrWords |
( |
word * |
r, |
|
|
const word * |
a, |
|
|
size_t |
n |
|
) |
| |
|
inline |
OR word arrays.
- Parameters
-
r | destination word array |
a | source word array |
n | size of the word array, in elements |
OrWords ORs the source word array with the destination word array.
- Since
- Crypto++ 1.0
Definition at line 133 of file words.h.
◆ SetWords()
void SetWords |
( |
word * |
r, |
|
|
word |
a, |
|
|
size_t |
n |
|
) |
| |
|
inline |
Set the value of words.
- Parameters
-
r | word array |
a | value |
n | size of the word array, in elements |
SetWords sets all elements in the word array to the specified value.
- Since
- Crypto++ 1.0
Definition at line 35 of file words.h.
◆ ShiftWordsLeftByBits()
word ShiftWordsLeftByBits |
( |
word * |
r, |
|
|
size_t |
n, |
|
|
unsigned int |
shiftBits |
|
) |
| |
|
inline |
Left shift word array.
- Parameters
-
r | word array |
n | size of the word array, in elements |
shiftBits | number of bits to shift |
- Returns
- word shifted out
ShiftWordsLeftByBits shifts the word array left by shiftBits. ShiftWordsLeftByBits shifts bits out on the left; it does not extend the array.
- Note
- shiftBits must be less than WORD_BITS.
- Since
- Crypto++ 1.0
Definition at line 149 of file words.h.
◆ ShiftWordsLeftByWords()
void ShiftWordsLeftByWords |
( |
word * |
r, |
|
|
size_t |
n, |
|
|
size_t |
shiftWords |
|
) |
| |
|
inline |
Left shift word array.
- Parameters
-
r | word array |
n | size of the word array, in elements |
shiftWords | number of words to shift |
ShiftWordsLeftByWords shifts the word array left by shiftWords. ShiftWordsLeftByWords shifts bits out on the left; it does not extend the array.
- Since
- Crypto++ 1.0
Definition at line 194 of file words.h.
◆ ShiftWordsRightByBits()
word ShiftWordsRightByBits |
( |
word * |
r, |
|
|
size_t |
n, |
|
|
unsigned int |
shiftBits |
|
) |
| |
|
inline |
Right shift word array.
- Parameters
-
r | word array |
n | size of the word array, in elements |
shiftBits | number of bits to shift |
- Returns
- word shifted out
ShiftWordsRightByBits shifts the word array shight by shiftBits. ShiftWordsRightByBits shifts bits out on the right.
- Note
- shiftBits must be less than WORD_BITS.
- Since
- Crypto++ 1.0
Definition at line 172 of file words.h.
◆ ShiftWordsRightByWords()
void ShiftWordsRightByWords |
( |
word * |
r, |
|
|
size_t |
n, |
|
|
size_t |
shiftWords |
|
) |
| |
|
inline |
Right shift word array.
- Parameters
-
r | word array |
n | size of the word array, in elements |
shiftWords | number of words to shift |
ShiftWordsRightByWords shifts the word array right by shiftWords. ShiftWordsRightByWords shifts bits out on the right.
- Since
- Crypto++ 1.0
Definition at line 212 of file words.h.
◆ XorWords() [1/2]
void XorWords |
( |
word * |
r, |
|
|
const word * |
a, |
|
|
const word * |
b, |
|
|
size_t |
n |
|
) |
| |
|
inline |
XOR word arrays.
- Parameters
-
r | destination word array |
a | first source word array |
b | second source word array |
n | size of the word array, in elements |
XorWords XORs the two source word arrays and copies the result to the destination word array.
- Since
- Crypto++ 1.0
Definition at line 66 of file words.h.
◆ XorWords() [2/2]
void XorWords |
( |
word * |
r, |
|
|
const word * |
a, |
|
|
size_t |
n |
|
) |
| |
|
inline |
XOR word arrays.
- Parameters
-
r | destination word array |
a | source word array |
n | size of the word array, in elements |
XorWords XORs the source word array with the destination word array.
- Since
- Crypto++ 1.0
Definition at line 79 of file words.h.