From ca2783ce73fc976f2c6dbf34f9f2cd96e54b0dd8 Mon Sep 17 00:00:00 2001 From: Gaspard Petit Date: Fri, 8 Apr 2022 22:06:16 -0400 Subject: [PATCH] Added Polfosol from IMUtils and updated picobase64 --- .gitmodules | 3 + build/msvc/base64.vcxproj | 5 + build/msvc/base64.vcxproj.filters | 12 + libs/IMUtility | 1 + libs/picobase64 | 2 +- result/result/decode-msvc19.js | 615 +++++++++++----------- result/result/encode-msvc19.js | 589 +++++++++++---------- src/Base64SurveyTests.hpp | 6 +- src/IMUtility/base64.h | 0 src/IMUtility/polfosol_imutility.h | 33 ++ src/IMUtility/test_polfosol_imutility.cpp | 20 + src/Turbob64/test_turbob64.cpp | 4 +- 12 files changed, 698 insertions(+), 592 deletions(-) create mode 160000 libs/IMUtility create mode 100644 src/IMUtility/base64.h create mode 100644 src/IMUtility/polfosol_imutility.h create mode 100644 src/IMUtility/test_polfosol_imutility.cpp diff --git a/.gitmodules b/.gitmodules index a607125..234263c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -52,3 +52,6 @@ [submodule "libs/picobase64"] path = libs/picobase64 url = https://github.com/GermanAizek/picobase64 +[submodule "libs/IMUtility"] + path = libs/IMUtility + url = https://github.com/IMProject/IMUtility.git diff --git a/build/msvc/base64.vcxproj b/build/msvc/base64.vcxproj index 91ee125..9e17e3b 100644 --- a/build/msvc/base64.vcxproj +++ b/build/msvc/base64.vcxproj @@ -108,6 +108,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true Console @@ -122,6 +123,7 @@ Disabled _DEBUG;_CONSOLE;%(PreprocessorDefinitions) stdcpp17 + true Console @@ -181,6 +183,7 @@ + @@ -234,6 +237,8 @@ + + diff --git a/build/msvc/base64.vcxproj.filters b/build/msvc/base64.vcxproj.filters index 6523976..55d4a9d 100644 --- a/build/msvc/base64.vcxproj.filters +++ b/build/msvc/base64.vcxproj.filters @@ -80,6 +80,9 @@ {d490dd70-4257-4edf-88aa-65a4c6dbec0d} + + {ee2dde68-e341-4cca-aa30-e903808a5b15} + @@ -202,6 +205,9 @@ impl\picobase64 + + impl\IMUtility + @@ -270,5 +276,11 @@ Source Files + + impl\IMUtility + + + impl\IMUtility + \ No newline at end of file diff --git a/libs/IMUtility b/libs/IMUtility new file mode 160000 index 0000000..2496f70 --- /dev/null +++ b/libs/IMUtility @@ -0,0 +1 @@ +Subproject commit 2496f709b94b7f7312c6e9a6020acf7cd484d704 diff --git a/libs/picobase64 b/libs/picobase64 index 7dc5896..ed388f5 160000 --- a/libs/picobase64 +++ b/libs/picobase64 @@ -1 +1 @@ -Subproject commit 7dc58961dfbf29fc00db1ef931f6fb61e94c2759 +Subproject commit ed388f52bcac65f11ceb6c2878e1a4f58cd8b28c diff --git a/result/result/decode-msvc19.js b/result/result/decode-msvc19.js index 5e78a03..ce5630b 100644 --- a/result/result/decode-msvc19.js +++ b/result/result/decode-msvc19.js @@ -1,376 +1,391 @@ var decode_result_msvc19 = [ {name:'Adition', values:[ - {len:32,time:0.135728}, - {len:64,time:0.164703}, - {len:128,time:0.210417}, - {len:256,time:0.30556}, - {len:512,time:0.494981}, - {len:1024,time:0.851899}, - {len:2048,time:1.60571}, - {len:4096,time:3.04029}, - {len:8192,time:6.00157}, - {len:16384,time:11.8395}, - {len:32768,time:24.8735}, - {len:65536,time:47.0608} + {len:32,time:0.132202}, + {len:64,time:0.150803}, + {len:128,time:0.193248}, + {len:256,time:0.278963}, + {len:512,time:0.431429}, + {len:1024,time:0.730271}, + {len:2048,time:1.36733}, + {len:4096,time:2.63138}, + {len:8192,time:4.95116}, + {len:16384,time:9.83213}, + {len:32768,time:19.9364}, + {len:65536,time:38.9927} ]}, {name:'AdpGmbh', values:[ - {len:32,time:0.258321}, - {len:64,time:0.360739}, - {len:128,time:0.543407}, - {len:256,time:0.962974}, - {len:512,time:1.74513}, - {len:1024,time:3.28778}, - {len:2048,time:6.52963}, - {len:4096,time:26.5658}, - {len:8192,time:72.7708}, - {len:16384,time:165.422}, - {len:32768,time:338.562}, - {len:65536,time:677.588} + {len:32,time:0.258251}, + {len:64,time:0.378726}, + {len:128,time:0.56562}, + {len:256,time:0.964912}, + {len:512,time:1.79995}, + {len:1024,time:3.32956}, + {len:2048,time:6.73651}, + {len:4096,time:26.8595}, + {len:8192,time:73.9487}, + {len:16384,time:168.62}, + {len:32768,time:343.772}, + {len:65536,time:684.627} ]}, {name:'Apache', values:[ - {len:32,time:0.158675}, - {len:64,time:0.207553}, - {len:128,time:0.333431}, - {len:256,time:0.543182}, - {len:512,time:0.939255}, - {len:1024,time:1.80338}, - {len:2048,time:3.34581}, - {len:4096,time:6.55888}, - {len:8192,time:12.9671}, - {len:16384,time:26.2419}, - {len:32768,time:51.4746}, - {len:65536,time:103.683} + {len:32,time:0.161504}, + {len:64,time:0.210571}, + {len:128,time:0.346019}, + {len:256,time:0.552554}, + {len:512,time:0.927857}, + {len:1024,time:1.71649}, + {len:2048,time:3.28148}, + {len:4096,time:6.39776}, + {len:8192,time:12.7052}, + {len:16384,time:25.7471}, + {len:32768,time:50.4901}, + {len:65536,time:100.026} ]}, {name:'Arduino', values:[ - {len:32,time:0.204506}, - {len:64,time:0.310563}, - {len:128,time:0.502306}, - {len:256,time:0.899743}, - {len:512,time:1.66594}, - {len:1024,time:3.25718}, - {len:2048,time:11.474}, - {len:4096,time:30.0981}, - {len:8192,time:66.3563}, - {len:16384,time:145.294}, - {len:32768,time:297.481}, - {len:65536,time:594.683} + {len:32,time:0.209271}, + {len:64,time:0.30053}, + {len:128,time:0.493513}, + {len:256,time:0.897469}, + {len:512,time:1.62768}, + {len:1024,time:3.26812}, + {len:2048,time:12.6152}, + {len:4096,time:31.3502}, + {len:8192,time:69.1978}, + {len:16384,time:141.333}, + {len:32768,time:286.986}, + {len:65536,time:579.495} ]}, {name:'Boost', values:[ - {len:32,time:0.410823}, - {len:64,time:0.709823}, - {len:128,time:1.32407}, - {len:256,time:2.45369}, - {len:512,time:4.48546}, - {len:1024,time:8.5462}, - {len:2048,time:16.6087}, - {len:4096,time:32.5049}, - {len:8192,time:63.6867}, - {len:16384,time:127.112}, - {len:32768,time:255.867}, - {len:65536,time:501.045} + {len:32,time:0.414092}, + {len:64,time:1.33453}, + {len:128,time:1.34432}, + {len:256,time:2.54412}, + {len:512,time:4.46981}, + {len:1024,time:8.60607}, + {len:2048,time:16.5996}, + {len:4096,time:32.6155}, + {len:8192,time:63.9016}, + {len:16384,time:128.303}, + {len:32768,time:252.104}, + {len:65536,time:508.836} ]}, {name:'CppCodec', values:[ - {len:32,time:0.171238}, - {len:64,time:0.235587}, - {len:128,time:0.34854}, - {len:256,time:0.601305}, - {len:512,time:1.01435}, - {len:1024,time:1.90299}, - {len:2048,time:3.7058}, - {len:4096,time:7.22218}, - {len:8192,time:14.3747}, - {len:16384,time:28.6296}, - {len:32768,time:57.8295}, - {len:65536,time:113.934} + {len:32,time:0.165829}, + {len:64,time:0.232222}, + {len:128,time:0.353374}, + {len:256,time:0.590729}, + {len:512,time:1.02707}, + {len:1024,time:1.92698}, + {len:2048,time:3.72823}, + {len:4096,time:7.38321}, + {len:8192,time:14.973}, + {len:16384,time:29.6668}, + {len:32768,time:58.2425}, + {len:65536,time:117.094} ]}, {name:'DaedalusAlpha', values:[ - {len:32,time:0.248904}, - {len:64,time:0.336317}, - {len:128,time:0.493529}, - {len:256,time:0.811861}, - {len:512,time:1.46763}, - {len:1024,time:2.78346}, - {len:2048,time:5.31969}, - {len:4096,time:10.8067}, - {len:8192,time:21.148}, - {len:16384,time:43.7913}, - {len:32768,time:86.6672}, - {len:65536,time:175.501} + {len:32,time:0.245393}, + {len:64,time:0.329672}, + {len:128,time:0.484994}, + {len:256,time:0.798026}, + {len:512,time:1.40679}, + {len:1024,time:2.64988}, + {len:2048,time:5.10825}, + {len:4096,time:9.88598}, + {len:8192,time:20.1031}, + {len:16384,time:39.3108}, + {len:32768,time:79.67}, + {len:65536,time:156.098} ]}, {name:'ElegantDice', values:[ - {len:32,time:0.189304}, - {len:64,time:0.276456}, - {len:128,time:0.430766}, - {len:256,time:0.757928}, - {len:512,time:1.38804}, - {len:1024,time:2.70948}, - {len:2048,time:5.42806}, - {len:4096,time:10.462}, - {len:8192,time:21.0427}, - {len:16384,time:42.8298}, - {len:32768,time:88.0062}, - {len:65536,time:168.059} + {len:32,time:0.193516}, + {len:64,time:0.276834}, + {len:128,time:0.433104}, + {len:256,time:0.797825}, + {len:512,time:1.39464}, + {len:1024,time:2.70571}, + {len:2048,time:5.28428}, + {len:4096,time:10.6777}, + {len:8192,time:20.9918}, + {len:16384,time:45.025}, + {len:32768,time:86.469}, + {len:65536,time:171.521} ]}, {name:'Gnome', values:[ - {len:32,time:0.17715}, - {len:64,time:0.233225}, - {len:128,time:0.373048}, - {len:256,time:0.607424}, - {len:512,time:1.06139}, - {len:1024,time:1.98266}, - {len:2048,time:3.79737}, - {len:4096,time:7.45482}, - {len:8192,time:14.7474}, - {len:16384,time:30.0756}, - {len:32768,time:58.7487}, - {len:65536,time:118.045} + {len:32,time:0.168318}, + {len:64,time:0.236685}, + {len:128,time:0.391187}, + {len:256,time:0.622461}, + {len:512,time:1.13937}, + {len:1024,time:1.98512}, + {len:2048,time:4.00323}, + {len:4096,time:7.54905}, + {len:8192,time:14.9559}, + {len:16384,time:29.6148}, + {len:32768,time:59.5279}, + {len:65536,time:118.501} ]}, {name:'InternetSoftwareConsortium', values:[ - {len:32,time:0.317082}, - {len:64,time:0.528897}, - {len:128,time:0.933813}, - {len:256,time:1.80294}, - {len:512,time:3.43036}, - {len:1024,time:6.86745}, - {len:2048,time:18.2845}, - {len:4096,time:52.0443}, - {len:8192,time:126.329}, - {len:16384,time:258.801}, - {len:32768,time:520.73}, - {len:65536,time:1045.28} + {len:32,time:0.344708}, + {len:64,time:0.580171}, + {len:128,time:1.08832}, + {len:256,time:1.97805}, + {len:512,time:3.9327}, + {len:1024,time:7.71486}, + {len:2048,time:20.324}, + {len:4096,time:56.9976}, + {len:8192,time:136.358}, + {len:16384,time:281.527}, + {len:32768,time:562.084}, + {len:65536,time:1139.66} ]}, {name:'JouniMalinen', values:[ - {len:32,time:0.222059}, - {len:64,time:0.329015}, - {len:128,time:0.546951}, - {len:256,time:0.949527}, - {len:512,time:1.75923}, - {len:1024,time:3.43624}, - {len:2048,time:6.74682}, - {len:4096,time:13.2573}, - {len:8192,time:26.5748}, - {len:16384,time:52.5758}, - {len:32768,time:104.372}, - {len:65536,time:218.862} + {len:32,time:0.192197}, + {len:64,time:0.297026}, + {len:128,time:0.462489}, + {len:256,time:0.76235}, + {len:512,time:1.37705}, + {len:1024,time:2.67555}, + {len:2048,time:5.11117}, + {len:4096,time:10.0344}, + {len:8192,time:19.908}, + {len:16384,time:40.5862}, + {len:32768,time:79.1369}, + {len:65536,time:158.655} ]}, {name:'LibCurl', values:[ - {len:32,time:1.18909}, - {len:64,time:3.07613}, - {len:128,time:5.59716}, - {len:256,time:11.889}, - {len:512,time:25.0524}, - {len:1024,time:49.8026}, - {len:2048,time:99.9532}, - {len:4096,time:198.988}, - {len:8192,time:400.819}, - {len:16384,time:806.66}, - {len:32768,time:1609.36}, - {len:65536,time:3228.63} + {len:32,time:0.710787}, + {len:64,time:1.76399}, + {len:128,time:3.29059}, + {len:256,time:7.69839}, + {len:512,time:16.6797}, + {len:1024,time:34.145}, + {len:2048,time:69.2115}, + {len:4096,time:138.723}, + {len:8192,time:281.95}, + {len:16384,time:560.414}, + {len:32768,time:1124.1}, + {len:65536,time:2254.95} ]}, {name:'Libb64', values:[ - {len:32,time:1.29269}, - {len:64,time:1.43045}, - {len:128,time:1.62192}, - {len:256,time:1.8922}, - {len:512,time:2.42618}, - {len:1024,time:3.40818}, - {len:2048,time:5.07455}, - {len:4096,time:8.64722}, - {len:8192,time:15.1663}, - {len:16384,time:29.4035}, - {len:32768,time:60.8307}, - {len:65536,time:128.11} + {len:32,time:1.31905}, + {len:64,time:1.47865}, + {len:128,time:1.61801}, + {len:256,time:1.92355}, + {len:512,time:2.40459}, + {len:1024,time:3.3181}, + {len:2048,time:4.98721}, + {len:4096,time:8.22189}, + {len:8192,time:14.811}, + {len:16384,time:28.1568}, + {len:32768,time:59.7773}, + {len:65536,time:118.836} ]}, {name:'LihO', values:[ - {len:32,time:0.542199}, - {len:64,time:1.01622}, - {len:128,time:1.91973}, - {len:256,time:3.71303}, - {len:512,time:8.03034}, - {len:1024,time:19.5998}, - {len:2048,time:41.9461}, - {len:4096,time:88.2904}, - {len:8192,time:185.908}, - {len:16384,time:354.758}, - {len:32768,time:714.13}, - {len:65536,time:1412.58} + {len:32,time:0.576201}, + {len:64,time:1.73367}, + {len:128,time:2.03439}, + {len:256,time:4.1255}, + {len:512,time:8.77284}, + {len:1024,time:20.4286}, + {len:2048,time:45.1472}, + {len:4096,time:95.0688}, + {len:8192,time:189.651}, + {len:16384,time:399.899}, + {len:32768,time:758.635}, + {len:65536,time:1515.72} ]}, {name:'ManuelMartinez', values:[ - {len:32,time:0.320726}, - {len:64,time:0.453044}, - {len:128,time:0.727486}, - {len:256,time:1.17829}, - {len:512,time:1.79828}, - {len:1024,time:2.97941}, - {len:2048,time:5.25728}, - {len:4096,time:9.59001}, - {len:8192,time:17.7986}, - {len:16384,time:34.7768}, - {len:32768,time:68.4764}, - {len:65536,time:134.361} + {len:32,time:0.315526}, + {len:64,time:1.02919}, + {len:128,time:0.705929}, + {len:256,time:1.13054}, + {len:512,time:1.78457}, + {len:1024,time:3.64437}, + {len:2048,time:5.18568}, + {len:4096,time:9.46193}, + {len:8192,time:18.124}, + {len:16384,time:34.8706}, + {len:32768,time:69.6397}, + {len:65536,time:134.838} ]}, {name:'ModpB64Chromium', values:[ - {len:32,time:0.12202}, - {len:64,time:0.133157}, - {len:128,time:0.16043}, - {len:256,time:0.230658}, - {len:512,time:0.342373}, - {len:1024,time:0.56589}, - {len:2048,time:1.00151}, - {len:4096,time:1.96276}, - {len:8192,time:3.75621}, - {len:16384,time:7.32795}, - {len:32768,time:14.6273}, - {len:65536,time:29.0361} + {len:32,time:0.12801}, + {len:64,time:0.143887}, + {len:128,time:0.183676}, + {len:256,time:0.259111}, + {len:512,time:0.39385}, + {len:1024,time:0.674022}, + {len:2048,time:1.22552}, + {len:4096,time:2.37636}, + {len:8192,time:4.56261}, + {len:16384,time:9.14457}, + {len:32768,time:22.086}, + {len:65536,time:36.5139} ]}, {name:'NibbleAndAHalf', values:[ - {len:32,time:0.122707}, - {len:64,time:0.139061}, - {len:128,time:0.173348}, - {len:256,time:0.263791}, - {len:512,time:0.394989}, - {len:1024,time:0.661089}, - {len:2048,time:1.17613}, - {len:4096,time:2.24077}, - {len:8192,time:4.39811}, - {len:16384,time:8.72147}, - {len:32768,time:17.5614}, - {len:65536,time:34.4204} + {len:32,time:0.131104}, + {len:64,time:0.145124}, + {len:128,time:0.17916}, + {len:256,time:0.258764}, + {len:512,time:0.390009}, + {len:1024,time:0.65473}, + {len:2048,time:1.17912}, + {len:4096,time:2.27582}, + {len:8192,time:4.54561}, + {len:16384,time:8.80535}, + {len:32768,time:17.416}, + {len:65536,time:35.0659} ]}, {name:'Polfosol', values:[ - {len:32,time:0.190113}, - {len:64,time:0.163863}, - {len:128,time:0.295054}, - {len:256,time:0.371654}, - {len:512,time:0.688794}, - {len:1024,time:1.13478}, - {len:2048,time:2.29337}, - {len:4096,time:4.12287}, - {len:8192,time:8.30542}, - {len:16384,time:16.213}, - {len:32768,time:33.5818}, - {len:65536,time:64.6035} + {len:32,time:0.203849}, + {len:64,time:0.157989}, + {len:128,time:0.273468}, + {len:256,time:0.324965}, + {len:512,time:0.621284}, + {len:1024,time:0.949698}, + {len:2048,time:1.90465}, + {len:4096,time:3.44542}, + {len:8192,time:7.1142}, + {len:16384,time:13.6106}, + {len:32768,time:28.2863}, + {len:65536,time:54.3433} + ]}, + {name:'Polfosol_IMUtility', + values:[ + {len:32,time:0.134385}, + {len:64,time:0.153558}, + {len:128,time:0.209418}, + {len:256,time:0.289726}, + {len:512,time:0.469094}, + {len:1024,time:0.773127}, + {len:2048,time:1.49239}, + {len:4096,time:2.76016}, + {len:8192,time:5.50603}, + {len:16384,time:11.4219}, + {len:32768,time:22.8209}, + {len:65536,time:45.7963} ]}, {name:'Polfosol_mod', values:[ - {len:32,time:0.134027}, - {len:64,time:0.158372}, - {len:128,time:0.216302}, - {len:256,time:0.336346}, - {len:512,time:0.528816}, - {len:1024,time:0.937627}, - {len:2048,time:1.75928}, - {len:4096,time:3.3623}, - {len:8192,time:6.8559}, - {len:16384,time:13.4423}, - {len:32768,time:26.341}, - {len:65536,time:52.7072} + {len:32,time:0.15066}, + {len:64,time:0.171129}, + {len:128,time:0.228621}, + {len:256,time:0.333187}, + {len:512,time:0.550387}, + {len:1024,time:0.956072}, + {len:2048,time:1.82016}, + {len:4096,time:3.43594}, + {len:8192,time:6.86693}, + {len:16384,time:13.9788}, + {len:32768,time:27.5581}, + {len:65536,time:54.091} ]}, {name:'TomyKaria', values:[ - {len:32,time:0.186441}, - {len:64,time:0.288104}, - {len:128,time:0.42758}, - {len:256,time:0.744947}, - {len:512,time:1.36232}, - {len:1024,time:2.56863}, - {len:2048,time:5.03581}, - {len:4096,time:9.94443}, - {len:8192,time:19.7322}, - {len:16384,time:40.4084}, - {len:32768,time:78.8771}, - {len:65536,time:157.69} + {len:32,time:0.185721}, + {len:64,time:0.27283}, + {len:128,time:0.427785}, + {len:256,time:0.742837}, + {len:512,time:1.37614}, + {len:1024,time:2.62434}, + {len:2048,time:5.0922}, + {len:4096,time:9.98249}, + {len:8192,time:20.1159}, + {len:16384,time:41.281}, + {len:32768,time:83.4137}, + {len:65536,time:166.055} ]}, {name:'Turbob64', values:[ - {len:32,time:0.150624}, - {len:64,time:0.168231}, - {len:128,time:0.216789}, - {len:256,time:0.297164}, - {len:512,time:0.393231}, - {len:1024,time:0.5757}, - {len:2048,time:0.930089}, - {len:4096,time:1.6632}, - {len:8192,time:3.11897}, - {len:16384,time:6.40146}, - {len:32768,time:13.0292}, - {len:65536,time:25.719} + {len:32,time:0.122906}, + {len:64,time:0.124804}, + {len:128,time:0.133627}, + {len:256,time:0.147945}, + {len:512,time:0.177636}, + {len:1024,time:0.2171}, + {len:2048,time:0.295857}, + {len:4096,time:0.440079}, + {len:8192,time:0.745319}, + {len:16384,time:1.40916}, + {len:32768,time:3.00336}, + {len:65536,time:5.77903} ]}, {name:'User152949', values:[ - {len:32,time:3.18859}, - {len:64,time:5.51131}, - {len:128,time:10.2264}, - {len:256,time:19.1537}, - {len:512,time:40.8125}, - {len:1024,time:74.0093}, - {len:2048,time:153.917}, - {len:4096,time:310.513}, - {len:8192,time:711.999}, - {len:16384,time:1147.7}, - {len:32768,time:2593.35}, - {len:65536,time:4768.13} + {len:32,time:3.10956}, + {len:64,time:5.50378}, + {len:128,time:10.2007}, + {len:256,time:20.5337}, + {len:512,time:37.2644}, + {len:1024,time:72.4544}, + {len:2048,time:149.601}, + {len:4096,time:289.108}, + {len:8192,time:573.726}, + {len:16384,time:1148.25}, + {len:32768,time:2285.68}, + {len:65536,time:4746.06} ]}, {name:'WikibooksOrgC', values:[ - {len:32,time:0.185233}, - {len:64,time:0.274315}, - {len:128,time:0.43673}, - {len:256,time:0.76271}, - {len:512,time:1.39726}, - {len:1024,time:2.71372}, - {len:2048,time:5.36119}, - {len:4096,time:10.4833}, - {len:8192,time:20.8629}, - {len:16384,time:42.169}, - {len:32768,time:81.9721}, - {len:65536,time:165.369} + {len:32,time:0.196143}, + {len:64,time:0.280913}, + {len:128,time:0.442813}, + {len:256,time:0.769425}, + {len:512,time:1.40699}, + {len:1024,time:2.68021}, + {len:2048,time:5.31192}, + {len:4096,time:10.3456}, + {len:8192,time:20.5147}, + {len:16384,time:40.9943}, + {len:32768,time:83.6267}, + {len:65536,time:163.007} ]}, {name:'WikibooksOrgCpp', values:[ - {len:32,time:0.274812}, - {len:64,time:0.364223}, - {len:128,time:0.539191}, - {len:256,time:0.885948}, - {len:512,time:1.57423}, - {len:1024,time:2.92277}, - {len:2048,time:12.391}, - {len:4096,time:31.4516}, - {len:8192,time:69.3019}, - {len:16384,time:146.44}, - {len:32768,time:303.592}, - {len:65536,time:612.757} + {len:32,time:0.264843}, + {len:64,time:0.368627}, + {len:128,time:0.574245}, + {len:256,time:0.945044}, + {len:512,time:1.74564}, + {len:1024,time:3.32835}, + {len:2048,time:7.59477}, + {len:4096,time:25.2254}, + {len:8192,time:64.3098}, + {len:16384,time:142.788}, + {len:32768,time:297.717}, + {len:65536,time:614.977} ]}, {name:'picobase64', values:[ - {len:32,time:0.13087}, - {len:64,time:0.14894}, - {len:128,time:0.194115}, - {len:256,time:0.276004}, - {len:512,time:0.425694}, - {len:1024,time:0.735213}, - {len:2048,time:1.31488}, - {len:4096,time:2.58009}, - {len:8192,time:4.96353}, - {len:16384,time:9.89114}, - {len:32768,time:19.515}, - {len:65536,time:38.9352} + {len:32,time:0.134659}, + {len:64,time:0.160196}, + {len:128,time:0.221715}, + {len:256,time:0.310039}, + {len:512,time:0.495029}, + {len:1024,time:0.864147}, + {len:2048,time:1.63153}, + {len:4096,time:3.20875}, + {len:8192,time:6.06075}, + {len:16384,time:12.1564}, + {len:32768,time:23.8516}, + {len:65536,time:48.1236} ]}] diff --git a/result/result/encode-msvc19.js b/result/result/encode-msvc19.js index 3480b8a..192ecf6 100644 --- a/result/result/encode-msvc19.js +++ b/result/result/encode-msvc19.js @@ -1,361 +1,376 @@ var encode_result_msvc19 = [ {name:'Adition', values:[ - {len:32,time:0.132795}, - {len:64,time:0.150253}, - {len:128,time:0.204341}, - {len:256,time:0.277379}, - {len:512,time:0.439216}, - {len:1024,time:0.752123}, - {len:2048,time:1.39768}, - {len:4096,time:2.71451}, - {len:8192,time:5.25277}, - {len:16384,time:10.2475}, - {len:32768,time:20.2612}, - {len:65536,time:40.5526} + {len:32,time:0.181232}, + {len:64,time:0.165486}, + {len:128,time:0.223671}, + {len:256,time:0.345381}, + {len:512,time:0.506039}, + {len:1024,time:0.801128}, + {len:2048,time:1.47176}, + {len:4096,time:2.69087}, + {len:8192,time:5.28714}, + {len:16384,time:10.5829}, + {len:32768,time:21.2452}, + {len:65536,time:52.2397} ]}, {name:'AdpGmbh', values:[ - {len:32,time:0.165948}, - {len:64,time:0.240503}, - {len:128,time:0.363245}, - {len:256,time:0.605325}, - {len:512,time:1.09263}, - {len:1024,time:2.06859}, - {len:2048,time:4.00262}, - {len:4096,time:7.88327}, - {len:8192,time:15.8912}, - {len:16384,time:31.3433}, - {len:32768,time:63.1776}, - {len:65536,time:124.078} + {len:32,time:0.171229}, + {len:64,time:0.238799}, + {len:128,time:0.37025}, + {len:256,time:0.626155}, + {len:512,time:1.11154}, + {len:1024,time:2.15313}, + {len:2048,time:4.21391}, + {len:4096,time:8.45096}, + {len:8192,time:16.0685}, + {len:16384,time:45.1532}, + {len:32768,time:79.5623}, + {len:65536,time:131.807} ]}, {name:'Apache', values:[ - {len:32,time:0.125686}, - {len:64,time:0.143029}, - {len:128,time:0.190131}, - {len:256,time:0.269522}, - {len:512,time:0.433439}, - {len:1024,time:0.749556}, - {len:2048,time:1.3955}, - {len:4096,time:2.63629}, - {len:8192,time:5.17598}, - {len:16384,time:10.1696}, - {len:32768,time:20.2969}, - {len:65536,time:40.7236} + {len:32,time:0.131639}, + {len:64,time:0.159672}, + {len:128,time:0.226711}, + {len:256,time:0.316826}, + {len:512,time:0.504817}, + {len:1024,time:0.909337}, + {len:2048,time:1.67184}, + {len:4096,time:3.16978}, + {len:8192,time:5.97711}, + {len:16384,time:11.2405}, + {len:32768,time:22.1387}, + {len:65536,time:45.2956} ]}, {name:'Arduino', values:[ - {len:32,time:0.172564}, - {len:64,time:0.242098}, - {len:128,time:0.372246}, - {len:256,time:0.627656}, - {len:512,time:1.13806}, - {len:1024,time:2.12605}, - {len:2048,time:4.15606}, - {len:4096,time:8.06787}, - {len:8192,time:16.348}, - {len:16384,time:32.2473}, - {len:32768,time:65.4392}, - {len:65536,time:126.625} + {len:32,time:0.190376}, + {len:64,time:0.276303}, + {len:128,time:0.450477}, + {len:256,time:0.775796}, + {len:512,time:1.46252}, + {len:1024,time:2.6704}, + {len:2048,time:5.18372}, + {len:4096,time:10.0553}, + {len:8192,time:19.9957}, + {len:16384,time:40.026}, + {len:32768,time:79.7954}, + {len:65536,time:163.134} ]}, {name:'Boost', values:[ - {len:32,time:0.454799}, - {len:64,time:0.778454}, - {len:128,time:1.3689}, - {len:256,time:2.25567}, - {len:512,time:4.03006}, - {len:1024,time:7.33314}, - {len:2048,time:13.9376}, - {len:4096,time:26.6585}, - {len:8192,time:52.6894}, - {len:16384,time:103.855}, - {len:32768,time:207.14}, - {len:65536,time:545.108} + {len:32,time:0.453384}, + {len:64,time:0.792382}, + {len:128,time:1.38865}, + {len:256,time:2.29607}, + {len:512,time:4.01877}, + {len:1024,time:7.47804}, + {len:2048,time:14.413}, + {len:4096,time:27.0642}, + {len:8192,time:52.92}, + {len:16384,time:104.714}, + {len:32768,time:206.61}, + {len:65536,time:420.218} ]}, {name:'CppCodec', values:[ - {len:32,time:0.16631}, - {len:64,time:0.22668}, - {len:128,time:0.364788}, - {len:256,time:0.609958}, - {len:512,time:1.07929}, - {len:1024,time:2.04362}, - {len:2048,time:3.96112}, + {len:32,time:0.168992}, + {len:64,time:0.230461}, + {len:128,time:0.354248}, + {len:256,time:0.603219}, + {len:512,time:1.07198}, + {len:1024,time:2.04418}, + {len:2048,time:3.99164}, {len:4096,time:7.8685}, - {len:8192,time:15.8284}, - {len:16384,time:31.8037}, - {len:32768,time:63.915}, - {len:65536,time:134.796} + {len:8192,time:15.8196}, + {len:16384,time:31.9034}, + {len:32768,time:63.4694}, + {len:65536,time:126.773} ]}, {name:'DaedalusAlpha', values:[ - {len:32,time:0.729302}, - {len:64,time:0.247737}, - {len:128,time:0.366141}, - {len:256,time:0.63833}, - {len:512,time:1.09816}, - {len:1024,time:2.18578}, - {len:2048,time:4.01692}, - {len:4096,time:8.1912}, - {len:8192,time:15.7294}, - {len:16384,time:32.4433}, - {len:32768,time:62.7093}, - {len:65536,time:132.791} + {len:32,time:0.173169}, + {len:64,time:0.242913}, + {len:128,time:0.363294}, + {len:256,time:0.632786}, + {len:512,time:1.0853}, + {len:1024,time:2.12317}, + {len:2048,time:4.03046}, + {len:4096,time:8.04153}, + {len:8192,time:15.6406}, + {len:16384,time:31.7068}, + {len:32768,time:62.3148}, + {len:65536,time:127.426} ]}, {name:'ElegantDice', values:[ - {len:32,time:0.171943}, - {len:64,time:0.250149}, - {len:128,time:0.387685}, - {len:256,time:0.64474}, - {len:512,time:1.14105}, - {len:1024,time:2.2251}, - {len:2048,time:4.33397}, - {len:4096,time:8.54612}, - {len:8192,time:16.633}, - {len:16384,time:33.5947}, - {len:32768,time:66.1887}, - {len:65536,time:137.418} + {len:32,time:0.176261}, + {len:64,time:0.250299}, + {len:128,time:0.377263}, + {len:256,time:0.648191}, + {len:512,time:1.15667}, + {len:1024,time:2.23835}, + {len:2048,time:4.26628}, + {len:4096,time:8.80785}, + {len:8192,time:16.6131}, + {len:16384,time:34.0424}, + {len:32768,time:68.55}, + {len:65536,time:136.176} ]}, {name:'Gnome', values:[ - {len:32,time:0.214277}, - {len:64,time:0.252689}, - {len:128,time:0.35342}, - {len:256,time:0.51252}, - {len:512,time:0.817086}, - {len:1024,time:1.43347}, - {len:2048,time:2.72852}, - {len:4096,time:5.16848}, - {len:8192,time:10.32}, - {len:16384,time:20.6103}, - {len:32768,time:47.1572}, - {len:65536,time:102.705} + {len:32,time:0.219942}, + {len:64,time:0.273444}, + {len:128,time:0.357137}, + {len:256,time:0.514943}, + {len:512,time:0.824642}, + {len:1024,time:1.43524}, + {len:2048,time:2.75904}, + {len:4096,time:5.19047}, + {len:8192,time:10.2273}, + {len:16384,time:20.7442}, + {len:32768,time:42.6892}, + {len:65536,time:84.5315} ]}, {name:'InternetSoftwareConsortium', values:[ - {len:32,time:0.133544}, - {len:64,time:0.165344}, - {len:128,time:0.216686}, - {len:256,time:0.313892}, - {len:512,time:0.518049}, - {len:1024,time:0.901912}, - {len:2048,time:1.70101}, - {len:4096,time:3.26083}, - {len:8192,time:6.43882}, - {len:16384,time:12.6837}, - {len:32768,time:25.3156}, - {len:65536,time:53.3489} + {len:32,time:0.143602}, + {len:64,time:0.171524}, + {len:128,time:0.242379}, + {len:256,time:0.35355}, + {len:512,time:0.603243}, + {len:1024,time:1.04758}, + {len:2048,time:1.99155}, + {len:4096,time:3.87885}, + {len:8192,time:7.68303}, + {len:16384,time:14.8534}, + {len:32768,time:30.0821}, + {len:65536,time:60.3493} ]}, {name:'JouniMalinen', values:[ - {len:32,time:0.12671}, - {len:64,time:0.146608}, - {len:128,time:0.198845}, - {len:256,time:0.290538}, - {len:512,time:0.455423}, - {len:1024,time:0.779234}, - {len:2048,time:1.44194}, - {len:4096,time:2.72256}, - {len:8192,time:5.41054}, - {len:16384,time:10.621}, - {len:32768,time:21.0142}, - {len:65536,time:45.0475} + {len:32,time:0.132069}, + {len:64,time:0.153246}, + {len:128,time:0.204657}, + {len:256,time:0.287585}, + {len:512,time:0.454168}, + {len:1024,time:0.774772}, + {len:2048,time:1.44357}, + {len:4096,time:2.74706}, + {len:8192,time:5.69751}, + {len:16384,time:10.9675}, + {len:32768,time:21.3711}, + {len:65536,time:42.9108} ]}, {name:'LibCurl', values:[ - {len:32,time:1.10291}, - {len:64,time:2.09599}, - {len:128,time:4.0487}, - {len:256,time:7.93977}, - {len:512,time:15.476}, - {len:1024,time:31.9802}, - {len:2048,time:61.8746}, - {len:4096,time:122.942}, - {len:8192,time:244.386}, - {len:16384,time:489.674}, - {len:32768,time:979.288}, - {len:65536,time:2007.24} + {len:32,time:1.1116}, + {len:64,time:2.10532}, + {len:128,time:4.17451}, + {len:256,time:7.89311}, + {len:512,time:15.7231}, + {len:1024,time:31.771}, + {len:2048,time:62.0544}, + {len:4096,time:125.553}, + {len:8192,time:254.536}, + {len:16384,time:499.008}, + {len:32768,time:1009.11}, + {len:65536,time:1986.33} ]}, {name:'Libb64', values:[ - {len:32,time:1.77424}, - {len:64,time:1.82052}, - {len:128,time:1.99827}, - {len:256,time:2.38127}, - {len:512,time:2.58615}, - {len:1024,time:3.13701}, - {len:2048,time:4.42973}, - {len:4096,time:7.18944}, - {len:8192,time:13.3901}, - {len:16384,time:29.1921}, - {len:32768,time:59.0833}, - {len:65536,time:112.373} + {len:32,time:2.03663}, + {len:64,time:2.10298}, + {len:128,time:1.5678}, + {len:256,time:1.85568}, + {len:512,time:2.26093}, + {len:1024,time:2.99346}, + {len:2048,time:4.79033}, + {len:4096,time:7.63366}, + {len:8192,time:12.7857}, + {len:16384,time:26.2138}, + {len:32768,time:52.9294}, + {len:65536,time:112.465} ]}, {name:'LihO', values:[ - {len:32,time:0.273963}, - {len:64,time:0.506605}, - {len:128,time:0.898363}, - {len:256,time:1.44318}, - {len:512,time:2.47232}, - {len:1024,time:4.33585}, - {len:2048,time:8.154}, - {len:4096,time:15.189}, - {len:8192,time:29.6659}, - {len:16384,time:58.7645}, - {len:32768,time:114.73}, - {len:65536,time:230.983} + {len:32,time:0.287863}, + {len:64,time:0.54602}, + {len:128,time:0.94865}, + {len:256,time:1.60095}, + {len:512,time:2.6926}, + {len:1024,time:4.99397}, + {len:2048,time:9.21646}, + {len:4096,time:17.2838}, + {len:8192,time:33.4815}, + {len:16384,time:66.9505}, + {len:32768,time:137.031}, + {len:65536,time:266.551} ]}, {name:'ManuelMartinez', values:[ - {len:32,time:0.264186}, - {len:64,time:0.471974}, - {len:128,time:0.832961}, - {len:256,time:1.30756}, - {len:512,time:2.22302}, - {len:1024,time:3.97906}, - {len:2048,time:7.36032}, - {len:4096,time:13.803}, - {len:8192,time:27.3262}, - {len:16384,time:53.2012}, - {len:32768,time:106.324}, - {len:65536,time:210.064} + {len:32,time:0.258039}, + {len:64,time:0.479711}, + {len:128,time:0.823441}, + {len:256,time:1.31705}, + {len:512,time:2.25504}, + {len:1024,time:4.85217}, + {len:2048,time:7.51173}, + {len:4096,time:14.73}, + {len:8192,time:27.6432}, + {len:16384,time:53.4658}, + {len:32768,time:109.633}, + {len:65536,time:210.842} ]}, {name:'ModpB64Chromium', values:[ - {len:32,time:0.124644}, - {len:64,time:0.149704}, - {len:128,time:0.20962}, - {len:256,time:0.299056}, - {len:512,time:0.480613}, - {len:1024,time:0.851938}, - {len:2048,time:1.59449}, - {len:4096,time:3.06602}, - {len:8192,time:6.01755}, - {len:16384,time:11.9688}, - {len:32768,time:23.88}, - {len:65536,time:47.5331} + {len:32,time:0.128596}, + {len:64,time:0.144855}, + {len:128,time:0.185046}, + {len:256,time:0.264795}, + {len:512,time:0.422471}, + {len:1024,time:0.724934}, + {len:2048,time:1.35521}, + {len:4096,time:2.55054}, + {len:8192,time:5.05905}, + {len:16384,time:9.83422}, + {len:32768,time:19.742}, + {len:65536,time:39.1084} ]}, {name:'NibbleAndAHalf', values:[ - {len:32,time:0.130715}, - {len:64,time:0.150614}, - {len:128,time:0.19662}, - {len:256,time:0.288522}, - {len:512,time:0.4469}, - {len:1024,time:0.768203}, - {len:2048,time:1.41464}, - {len:4096,time:2.73967}, - {len:8192,time:5.29729}, - {len:16384,time:10.5573}, - {len:32768,time:21.0227}, - {len:65536,time:41.889} + {len:32,time:0.128326}, + {len:64,time:0.156743}, + {len:128,time:0.196724}, + {len:256,time:0.287604}, + {len:512,time:0.452788}, + {len:1024,time:0.786782}, + {len:2048,time:1.4261}, + {len:4096,time:2.72902}, + {len:8192,time:5.39259}, + {len:16384,time:10.6197}, + {len:32768,time:21.1381}, + {len:65536,time:43.4361} ]}, {name:'Polfosol', values:[ - {len:32,time:0.137508}, - {len:64,time:0.163496}, - {len:128,time:0.23197}, - {len:256,time:0.367303}, - {len:512,time:0.610368}, - {len:1024,time:1.10079}, - {len:2048,time:2.08564}, - {len:4096,time:4.0618}, - {len:8192,time:8.01984}, - {len:16384,time:15.9059}, - {len:32768,time:31.9865}, - {len:65536,time:63.6362} + {len:32,time:0.134261}, + {len:64,time:0.166183}, + {len:128,time:0.234002}, + {len:256,time:0.364265}, + {len:512,time:0.621682}, + {len:1024,time:1.12994}, + {len:2048,time:2.09758}, + {len:4096,time:4.11621}, + {len:8192,time:8.11023}, + {len:16384,time:16.6114}, + {len:32768,time:32.3407}, + {len:65536,time:64.4306} + ]}, + {name:'Polfosol_IMUtility', + values:[ + {len:32,time:0.137945}, + {len:64,time:0.153128}, + {len:128,time:0.203788}, + {len:256,time:0.303413}, + {len:512,time:0.493045}, + {len:1024,time:0.856201}, + {len:2048,time:1.62665}, + {len:4096,time:3.08065}, + {len:8192,time:6.07983}, + {len:16384,time:12.0404}, + {len:32768,time:24.4761}, + {len:65536,time:47.9863} ]}, {name:'TomyKaria', values:[ - {len:32,time:0.204959}, - {len:64,time:0.233134}, - {len:128,time:0.3225}, - {len:256,time:0.467076}, - {len:512,time:0.738524}, - {len:1024,time:1.28965}, - {len:2048,time:2.42728}, - {len:4096,time:4.85829}, - {len:8192,time:9.43471}, - {len:16384,time:18.8725}, - {len:32768,time:36.3474}, - {len:65536,time:75.8388} + {len:32,time:0.202637}, + {len:64,time:0.236863}, + {len:128,time:0.318111}, + {len:256,time:0.464937}, + {len:512,time:0.765186}, + {len:1024,time:1.31178}, + {len:2048,time:2.44653}, + {len:4096,time:4.75421}, + {len:8192,time:9.40046}, + {len:16384,time:19.5646}, + {len:32768,time:38.0269}, + {len:65536,time:76.4015} ]}, {name:'Turbob64', values:[ - {len:32,time:0.123918}, - {len:64,time:0.138114}, - {len:128,time:0.165574}, - {len:256,time:0.210994}, - {len:512,time:0.280581}, - {len:1024,time:0.423611}, - {len:2048,time:0.697052}, - {len:4096,time:1.30222}, - {len:8192,time:2.59646}, - {len:16384,time:5.3362}, - {len:32768,time:10.8569}, - {len:65536,time:23.3857} + {len:32,time:0.112591}, + {len:64,time:0.119458}, + {len:128,time:0.124641}, + {len:256,time:0.144576}, + {len:512,time:0.15673}, + {len:1024,time:0.214113}, + {len:2048,time:0.284503}, + {len:4096,time:0.453905}, + {len:8192,time:0.763804}, + {len:16384,time:1.35581}, + {len:32768,time:2.67759}, + {len:65536,time:5.16954} ]}, {name:'User152949', values:[ - {len:32,time:3.11344}, - {len:64,time:5.41437}, - {len:128,time:9.70704}, - {len:256,time:18.1374}, - {len:512,time:35.1203}, - {len:1024,time:72.5145}, - {len:2048,time:137.116}, - {len:4096,time:269.192}, - {len:8192,time:533.759}, - {len:16384,time:1110.91}, - {len:32768,time:2132.02}, - {len:65536,time:4324.34} + {len:32,time:3.08408}, + {len:64,time:5.99405}, + {len:128,time:10.0064}, + {len:256,time:18.6409}, + {len:512,time:37.5314}, + {len:1024,time:69.9765}, + {len:2048,time:135.598}, + {len:4096,time:271.424}, + {len:8192,time:541.208}, + {len:16384,time:1061.46}, + {len:32768,time:2155.57}, + {len:65536,time:4310.8} ]}, {name:'WikibooksOrgC', values:[ - {len:32,time:0.152243}, - {len:64,time:0.195847}, - {len:128,time:0.290132}, - {len:256,time:0.46425}, - {len:512,time:0.804021}, - {len:1024,time:1.51287}, - {len:2048,time:2.84461}, - {len:4096,time:5.56187}, - {len:8192,time:11.0235}, - {len:16384,time:22.832}, - {len:32768,time:43.9964}, - {len:65536,time:87.6147} + {len:32,time:0.172745}, + {len:64,time:0.197727}, + {len:128,time:0.303082}, + {len:256,time:0.481342}, + {len:512,time:0.846694}, + {len:1024,time:1.50985}, + {len:2048,time:2.90623}, + {len:4096,time:5.63412}, + {len:8192,time:11.1404}, + {len:16384,time:22.2515}, + {len:32768,time:44.4992}, + {len:65536,time:88.7365} ]}, {name:'WikibooksOrgCpp', values:[ - {len:32,time:0.236429}, - {len:64,time:0.304022}, - {len:128,time:0.43864}, - {len:256,time:0.699023}, - {len:512,time:1.19997}, - {len:1024,time:2.20723}, - {len:2048,time:4.32425}, - {len:4096,time:8.3163}, - {len:8192,time:16.4113}, - {len:16384,time:33.6578}, - {len:32768,time:67.5974}, - {len:65536,time:132.288} + {len:32,time:0.248285}, + {len:64,time:0.320387}, + {len:128,time:0.472865}, + {len:256,time:0.770447}, + {len:512,time:1.29663}, + {len:1024,time:2.39825}, + {len:2048,time:4.63854}, + {len:4096,time:9.28154}, + {len:8192,time:18.1112}, + {len:16384,time:35.9335}, + {len:32768,time:70.9058}, + {len:65536,time:144.114} ]}, {name:'picobase64', values:[ - {len:32,time:0.130347}, - {len:64,time:0.144993}, - {len:128,time:0.196238}, - {len:256,time:0.272442}, - {len:512,time:0.451172}, - {len:1024,time:0.74403}, - {len:2048,time:1.40784}, - {len:4096,time:2.67188}, - {len:8192,time:5.14973}, - {len:16384,time:10.2116}, - {len:32768,time:20.3549}, - {len:65536,time:40.3278} + {len:32,time:0.771903}, + {len:64,time:0.159806}, + {len:128,time:0.206504}, + {len:256,time:0.277264}, + {len:512,time:0.444405}, + {len:1024,time:0.763454}, + {len:2048,time:1.42243}, + {len:4096,time:2.7525}, + {len:8192,time:5.20024}, + {len:16384,time:10.3602}, + {len:32768,time:20.6052}, + {len:65536,time:40.9836} ]}] diff --git a/src/Base64SurveyTests.hpp b/src/Base64SurveyTests.hpp index 58eacf9..ba3e242 100644 --- a/src/Base64SurveyTests.hpp +++ b/src/Base64SurveyTests.hpp @@ -22,14 +22,16 @@ struct Base64SurveyTests static void test_encode(const string &str, const string &expected) { BASE64Impl impl; - ASSERT_EQ(expected, impl.encode(str)); + string observed = impl.encode(str); + ASSERT_EQ(expected, observed); } template static void test_decode(const string &str, const string &expected) { BASE64Impl impl; - ASSERT_EQ(expected, impl.decode(str)); + string observed = impl.decode(str); + ASSERT_EQ(expected, observed); } static int RunTests(int argc, char *argv[]); diff --git a/src/IMUtility/base64.h b/src/IMUtility/base64.h new file mode 100644 index 0000000..e69de29 diff --git a/src/IMUtility/polfosol_imutility.h b/src/IMUtility/polfosol_imutility.h new file mode 100644 index 0000000..1736203 --- /dev/null +++ b/src/IMUtility/polfosol_imutility.h @@ -0,0 +1,33 @@ +#include +#include +namespace polfosol_imutility { + +#define BOOTLOADER_UTILITY_INC_BASE64_H_ + +#include "IMUtility/Src/base64.c" + +std::string Base64_encode(unsigned char *bytes, size_t len) +{ + size_t d = len % 3; + std::string str64(4 * (int(d > 0) + len / 3), '='); + + Base64_encode(bytes, len, (char*)&str64[0], str64.size()); + + return str64; +} + +std::string Base64_decode(unsigned char *p, size_t len) +{ + int pad = len > 0 && (len % 4 || p[len - 1] == '='); + const size_t L = ((len + 3) / 4 - pad) * 4; + if ((len > (L + 2U)) && (p[L + 2U] != '=')) + ++pad; + std::string str(L / 4 * 3 + pad, '\0'); + + Base64_decode((char*)p, len, (unsigned char*)&str[0], str.size()); + + return str; +} + + +} // namespace polfosol diff --git a/src/IMUtility/test_polfosol_imutility.cpp b/src/IMUtility/test_polfosol_imutility.cpp new file mode 100644 index 0000000..c62d620 --- /dev/null +++ b/src/IMUtility/test_polfosol_imutility.cpp @@ -0,0 +1,20 @@ +#include "polfosol_imutility.h" +#include +#include "../Base64SurveyRegistry.hpp" + +struct Polfosol_IMUtility +{ + std::string encode(const std::string &bytes) + { + return polfosol_imutility::Base64_encode((unsigned char*)bytes.data(), bytes.length()); + } + + std::string decode(const std::string &base64) + { + return polfosol_imutility::Base64_decode((unsigned char*)base64.data(), base64.length()); + } +}; + + +BASE64_REGISTER_ENCODER(Polfosol_IMUtility); +BASE64_REGISTER_DECODER(Polfosol_IMUtility); diff --git a/src/Turbob64/test_turbob64.cpp b/src/Turbob64/test_turbob64.cpp index 12424aa..1189017 100644 --- a/src/Turbob64/test_turbob64.cpp +++ b/src/Turbob64/test_turbob64.cpp @@ -60,12 +60,12 @@ struct Turbob64 { std::string encode(const std::string &bytes) { - return B64_Adapt::encode(tb64enc, bytes); + return B64_Adapt::encode(tb64v256enc, bytes); } std::string decode(const std::string &base64) { - return B64_Adapt::decode(tb64dec, base64); + return B64_Adapt::decode(tb64v256dec, base64); } };