GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing cpp.libhunt.com — cppcodec Alternatives - C++ Serialization | LibHunt cppcodecHeader-only C++11 library to encode/decode base64, base64url, base32, base32hex and hex (a.k.a. base16) as specified in RFC 4648, plus Crockford's base32. MIT licensed with consistent, flexible API.
Take the C++ Developer Survey
- About 6 minutes on the tools, libraries and AI you use with C++. You get the results by email.
Take the survey »
Popularity
4.7
Stable
Activity
0.0
Stable
Stars
696
Watchers
24
Forks
123
Last Commit
Code Quality Rank:
L2
Programming language: C++
License: MIT License
Tags:
Serialization
Latest version: v0.2
cppcodec alternatives and similar libraries
Based on the "Serialization" category.
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
Promo
www.saashub.com
* Code Quality Rankings and insights are calculated and provided by Lumnify.
Do you think we are missing an alternative of cppcodec or a related project? READMEcppcodecHeader-only C++11 library to encode/decode base64, base64url, base32, base32hex and hex (a.k.a. base16) as specified in RFC 4648, plus Crockford's base32. MIT licensed with consistent, flexible API. Supports raw pointers,
Contents
Usage
Since cppcodec is a header-only library, no extra build step is needed. Alternatively, you can install the headers and build extra tools/tests with CMake. VariantsA number of codec variants exist for base64 and base32, defining different alphabets or specifying the use of padding and line breaks in different ways. cppcodec is designed to let you make a conscious choice about which one you're using, see below for a list of variants. cppcodec's approach is to implement encoding/decoding algorithms in different classes for namespacing (e.g. Here is an expected standard use of cppcodec:
(The prior example included "baseXX_default_*.h" includes, these are not recommended anymore and may eventually get deprecated.) Currently supported codec variants are: base64
base32All base32 variants encode 5 bits as one (8-bit) character, which results in an encoded length of roughly 160% (= 8/5). Their selling point is mainly case-insensitive decoding, no special characters and alphabets that can be communicated via phone.
hex
Philosophy and trade-offscppcodec aims to support a range of codecs using a shared template-based implementation. The focus is on a high-quality API that encourages correct use, includes error handling, and is easy to adopt into other codebases. As a header-only library, cppcodec can ship implementations of several codecs and variants while only compiling the ones that you actually use. Good performance is a goal, but not the topmost priority. In theory, templates allows to write generic code that is optimized for each specialization individually; however, in practice compilers still struggle to produce code that's as simple as a hand-written specialized function. On release builds, depending on the C++ compiler, cppcodec runs in between (approx.) 100% and 300% of time compared to "regular" optimized base64 implementations. Both are beat by highly optimized implementations that use vector instructions (such as this) or buy better performance with larger pre-computed tables (such as Chrome's base64 implementation). Debug builds of cppcodec are slower by an order of magnitude due to the use of templates and abstractions; make sure you use release or minimum-size builds in production. APIAll codecs expose the same API. In the below documentation, replace For templated parameters
It's possible to support types lacking these functions, consult the code directly if you need this. Encoding
Encode binary data into an encoded (base64/base32/hex) string.
Won't throw by itself, but the result type might throw on
Encode binary data into pre-allocated memory with a buffer size of
Returns the byte size of the encoded string excluding null termination,
which is equal to If Calls abort() if
Calculate the (exact) length of the encoded string based on binary size, excluding null termination but including padding (if specified by the codec variant). Decoding
Decode an encoded (base64/base32/hex) string into a binary buffer. Throws a cppcodec::parse_error exception (inheriting from std::domain_error)
if the input data does not conform to the codec variant specification.
Also, the result type might throw on
Decode an encoded string into pre-allocated memory with a buffer size of
Returns the byte size of the decoded binary data, which is less or equal to
Calls abort() if
Calculate the maximum size of the decoded binary buffer based on the encoded string length. If the codec variant does not allow padding or whitespace / line breaks, the maximum decoded size will be the exact decoded size. If the codec variant allows padding or whitespace / line breaks, the actual decoded size might be smaller. If you're using the pre-allocated memory result call, make sure to take its return value (the actual decoded size) into account.
Do not miss the trending, libraries, news and articles with our weekly report.
Spin The Wheel Of Names
for a cryptographically secure random name picker.
Schedule a when to meet poll. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |