8#include "openssl/bignum_p.h"
9#include "openssl/opensslpp_p.h"
16static constexpr const char nlBase45Table[] =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
18static int8_t nlBase45MapFromChar(
char c)
20 const auto it = std::find(std::begin(nlBase45Table), std::end(nlBase45Table), c);
21 if (it == std::end(nlBase45Table)) {
22 qWarning() <<
"invalid base45 character:" << c;
25 return std::distance(std::begin(nlBase45Table), it);
28QByteArray NLBase45::decode(
const char *begin,
const char *end)
30 openssl::bn_ptr bn(BN_new());
32 for (
auto it = begin; it !=
end; ++it) {
33 BN_mul_word(bn.get(), 45);
34 auto v = nlBase45MapFromChar(*it);
38 BN_add_word(bn.get(), v);
40 return Bignum::toByteArray(bn);
const QList< QKeySequence > & end()
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 3 2025 11:48:56 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.