Compare commits
1 Commits
085f182357
...
1.0.3
| Author | SHA1 | Date | |
|---|---|---|---|
| ff888a88f4 |
2
Doxyfile
2
Doxyfile
@ -48,7 +48,7 @@ PROJECT_NAME = libbasen
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = v1.0.2
|
||||
PROJECT_NUMBER = v1.0.3
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
||||
6
Makefile
6
Makefile
@ -15,7 +15,7 @@ OBJS =\
|
||||
base64\
|
||||
hash/sha256\
|
||||
|
||||
TOOLS = ${LIB}
|
||||
TOOLS =\
|
||||
|
||||
TESTS =\
|
||||
test-hex\
|
||||
@ -59,8 +59,6 @@ DIRS =\
|
||||
${OBJDIR}\
|
||||
${OBJDIR}/hash\
|
||||
${LIBDIR}\
|
||||
doc\
|
||||
cov
|
||||
|
||||
build: library tools
|
||||
|
||||
@ -94,7 +92,7 @@ ${BINDIR}/%${-g}-cov: ${TESTDIR}/%.cpp ${patsubst %, ${OBJDIR}/%${-g}-cov.o, ${O
|
||||
${CC} -o $@ $^ -I${INCDIR} ${-l} -lgtest -lgcov ${CFLAGS}
|
||||
|
||||
clean:
|
||||
rm -rf ${DIRS}
|
||||
rm -rf ${DIRS} doc cov
|
||||
|
||||
ifneq (${OBJS},)
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ namespace base64
|
||||
case 2:
|
||||
str[last_idx] = digits[data[data_size - 2] >> 2];
|
||||
str[last_idx + 1] = digits[(data[data_size - 2] << 4 | data[data_size - 1] >> 4) & 0x3F];
|
||||
str[last_idx + 2] = digits[data[data_size - 1] & 0x0F];
|
||||
str[last_idx + 2] = digits[data[data_size - 1] << 2 & 0x3F];
|
||||
str[last_idx + 3] = '=';
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <argparse/argparse.hpp>
|
||||
|
||||
#include <basen.hpp>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argparse::ArgumentParser program("basen", "1.1.0");
|
||||
program.add_argument("-t", "--type")
|
||||
.help("encoding type")
|
||||
.metavar("STRING")
|
||||
.choices("base58", "base64", "hex")
|
||||
.default_value("hex");
|
||||
program.add_argument("-d", "--decode")
|
||||
.help("is decode")
|
||||
.flag();
|
||||
try
|
||||
{
|
||||
program.parse_args(argc, argv);
|
||||
}
|
||||
catch (const std::exception &err)
|
||||
{
|
||||
std::cerr << err.what() << '\n';
|
||||
std::cerr << program;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -21,8 +21,8 @@ TEST(base64, isValid)
|
||||
std::vector<std::pair<std::string, std::string>> tests = {
|
||||
{"", ""},
|
||||
{"BKUEpQ==", "04a504a5"},
|
||||
{"BKUEpQA=", "04a504a500"},
|
||||
{"BKUEpQAA", "04a504a50000"},
|
||||
{"aGVsbG8=", "68656c6c6f"},
|
||||
{"aGVsbG9v", "68656c6c6f6f"},
|
||||
};
|
||||
TEST(base64, encode)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user