CryptoSys PKI
23.0.0
|
Character conversion routines. More...
Public Types | |
enum class | EndianNess |
Byte order. More... | |
Static Public Member Functions | |
static int | CheckUTF8 (const bvec_t &bv) |
Check that a byte array contains only valid UTF-8 encoded characters. More... | |
static std::string | CheckUTF8CodeAsString (int n) |
Return a string describing an integer code returned by Cnv::CheckUTF8 or Cnv::CheckUTF8File. More... | |
static int | CheckUTF8File (const std::string &fileName) |
Check that a file contains only valid UTF-8 encoded characters. More... | |
static bvec_t | FromBase58 (const std::string &s) |
Decodes a base58-encoded string as an array of bytes. More... | |
static bvec_t | FromBase64 (const std::string &s) |
Decodes a base64-encoded string as an array of bytes. More... | |
static bvec_t | FromHex (const std::string &s) |
Decodes a hexadecimal-encoded string as an array of bytes. More... | |
static std::string | Latin1FromUTF8Bytes (const bvec_t &bv) |
Converts UTF-8 encoded array of bytes into a Latin-1 string, if possible. More... | |
static uint32_t | NumFromBytes (const bvec_t &bv, EndianNess endn=EndianNess::BigEndian) |
Convert the leftmost four bytes of an array to an unsigned 32-bit integer. More... | |
static bvec_t | NumToBytes (uint32_t n, EndianNess endn=EndianNess::BigEndian) |
Convert a 32-bit integer to an array of 4 bytes. More... | |
static bvec_t | ReverseBytes (const bvec_t &data) |
Reverse the order of a byte array. More... | |
static std::string | ShortPathName (const std::wstring &filePath) |
Retrieve the Windows short path form of the specified path. More... | |
static std::string | ToBase58 (const bvec_t &bv) |
Encodes an array of bytes as a base58-encoded string. More... | |
static std::string | ToBase64 (const bvec_t &bv) |
Encodes an array of bytes as a base64-encoded string. More... | |
static std::string | ToBase64 (const std::string &s) |
Encodes a string as a base64-encoded string. More... | |
static std::string | ToHex (const bvec_t &bv) |
Encodes an array of bytes as a hexadecimal-encoded string. More... | |
static std::string | ToHex (const std::string &s) |
Encodes a string as a hexadecimal-encoded string. More... | |
static bvec_t | UTF8BytesFromLatin1 (const std::string &s) |
Converts a string of 8-bit Latin-1 characters into a UTF-8 encoded array of bytes. More... | |
static std::string | Utf8FromWide (const std::wstring &wstr) |
Map a UTF-16 (wide character) string to a UTF-8-encoded string. More... | |
Character conversion routines.
|
strong |
|
static |
Check that a byte array contains only valid UTF-8 encoded characters.
bv | input byte array to check |
Return value | Meaning |
---|---|
0 | Not valid UTF-8 |
1 | Valid UTF-8, all chars are 7-bit ASCII |
2 | Valid UTF-8, contains at least one multi-byte character equivalent to 8-bit ANSI |
3 | Valid UTF-8, contains at least one multi-byte character that cannot be represented in a single-byte character set |
|
static |
Return a string describing an integer code returned by Cnv::CheckUTF8 or Cnv::CheckUTF8File.
n | Integer code |
|
static |
Check that a file contains only valid UTF-8 encoded characters.
fileName | name of file to check |
Return value | Meaning |
---|---|
0 | Not valid UTF-8 |
1 | Valid UTF-8, all chars are 7-bit ASCII |
2 | Valid UTF-8, contains at least one multi-byte character equivalent to 8-bit ANSI |
3 | Valid UTF-8, contains at least one multi-byte character that cannot be represented in a single-byte character set |
|
static |
Decodes a base58-encoded string as an array of bytes.
s | Base58-encoded string |
|
static |
Decodes a base64-encoded string as an array of bytes.
s | Base64-encoded string |
|
static |
Decodes a hexadecimal-encoded string as an array of bytes.
s | Hexadecimal-encoded data to be decoded. |
|
static |
Converts UTF-8 encoded array of bytes into a Latin-1 string, if possible.
bv | Array containing UTF-8 encoded data. |
|
static |
Convert the leftmost four bytes of an array to an unsigned 32-bit integer.
bv | Byte array to be converted |
endn | Byte order (default = Big Endian) |
|
static |
Convert a 32-bit integer to an array of 4 bytes.
n | Integer to be converted |
endn | Byte order (default = Big Endian) |
Reverse the order of a byte array.
data | Input data to be reversed |
|
static |
Retrieve the Windows short path form of the specified path.
filePath | Path name in wide characters. |
|
static |
Encodes an array of bytes as a base58-encoded string.
bv | Input byte array. |
|
static |
Encodes an array of bytes as a base64-encoded string.
bv | Input byte array. |
|
static |
Encodes a string as a base64-encoded string.
s | String to be encoded |
|
static |
Encodes an array of bytes as a hexadecimal-encoded string.
bv | Input byte array. |
|
static |
Encodes a string as a hexadecimal-encoded string.
s | String to be encoded |
|
static |
Converts a string of 8-bit Latin-1 characters into a UTF-8 encoded array of bytes.
s | Input string to be converted. |
|
static |
Map a UTF-16 (wide character) string to a UTF-8-encoded string.
wstr | String of wide characters to be processed. |