6 #if CRYPTOPP_MSC_VERSION
7 # pragma warning(disable: 4189)
8 # if (CRYPTOPP_MSC_VERSION >= 1400)
9 # pragma warning(disable: 6237)
13 #ifndef CRYPTOPP_IMPORTS
31 return reinterpret_cast<byte*
>(str.data());
38 return reinterpret_cast<const byte*
>(str.
data());
46 void xorbuf(
byte *buf,
const byte *mask,
size_t count)
53 if (IsAligned<word32>(buf) && IsAligned<word32>(mask))
55 if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsAligned<word64>(buf) && IsAligned<word64>(mask))
57 for (i=0; i<count/8; i++)
58 ((word64*)(
void*)buf)[i] ^= ((word64*)(
void*)mask)[i];
66 for (i=0; i<count/4; i++)
67 ((word32*)(
void*)buf)[i] ^= ((word32*)(
void*)mask)[i];
75 for (i=0; i<count; i++)
79 void xorbuf(
byte *output,
const byte *input,
const byte *mask,
size_t count)
86 if (IsAligned<word32>(output) && IsAligned<word32>(input) && IsAligned<word32>(mask))
88 if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsAligned<word64>(output) && IsAligned<word64>(input) && IsAligned<word64>(mask))
90 for (i=0; i<count/8; i++)
91 ((word64*)(
void*)output)[i] = ((word64*)(
void*)input)[i] ^ ((word64*)(
void*)mask)[i];
100 for (i=0; i<count/4; i++)
101 ((word32*)(
void*)output)[i] = ((word32*)(
void*)input)[i] ^ ((word32*)(
void*)mask)[i];
110 for (i=0; i<count; i++)
111 output[i] = input[i] ^ mask[i];
123 if (IsAligned<word32>(buf) && IsAligned<word32>(mask) && count)
126 if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsAligned<word64>(buf) && IsAligned<word64>(mask))
129 for (i=0; i<count/8; i++)
130 acc64 |= ((word64*)(
void*)buf)[i] ^ ((word64*)(
void*)mask)[i];
136 acc32 = word32(acc64) | word32(acc64>>32);
139 for (i=0; i<count/4; i++)
140 acc32 |= ((word32*)(
void*)buf)[i] ^ ((word32*)(
void*)mask)[i];
146 acc8 = byte(acc32) | byte(acc32>>8) | byte(acc32>>16) | byte(acc32>>24);
149 for (i=0; i<count; i++)
150 acc8 |= buf[i] ^ mask[i];
160 #if (CRYPTOPP_MSC_VERSION >= 1400)
161 size_t len=0, size=0;
168 err = wcstombs_s(&size, NULLPTR, 0, str, len*
sizeof(
wchar_t));
175 return std::string();
179 err = wcstombs_s(&size, &result[0], size, str, len*
sizeof(
wchar_t));
186 return std::string();
190 if (!result.empty() && result[size - 1] ==
'\0')
191 result.erase(size - 1);
193 size_t size = wcstombs(NULLPTR, str, 0);
195 if (size == (
size_t)-1)
200 return std::string();
204 size = wcstombs(&result[0], str, size);
206 if (size == (
size_t)-1)
211 return std::string();
224 #if (CRYPTOPP_MSC_VERSION >= 1400)
225 size_t len=0, size=0;
230 len = std::strlen(str)+1;
232 err = mbstowcs_s(&size, NULLPTR, 0, str, len);
239 return std::wstring();
243 err = mbstowcs_s(&size, &result[0], size, str, len);
250 return std::wstring();
254 if (!result.empty() && result[size - 1] ==
'\0')
255 result.erase(size - 1);
257 size_t size = mbstowcs(NULLPTR, str, 0);
259 if (size == (
size_t)-1)
264 return std::wstring();
268 size = mbstowcs(&result[0], str, size);
270 if (size == (
size_t)-1)
275 return std::wstring();