tstBase64.cpp revision c0e1b51d9d294f2826624ff25a2b759aab3ef5f9
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync/* $Id$ */
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync/** @file
80096fb54d147045204dcc7e3ff273158de03f81vboxsync * IPRT Testcase - Base64.
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync */
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync/*
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * Copyright (C) 2009 Sun Microsystems, Inc.
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync *
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * available from http://www.virtualbox.org. This file is free software;
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * you can redistribute it and/or modify it under the terms of the GNU
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync *
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * The contents of this file may alternatively be used under the terms
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * of the Common Development and Distribution License Version 1.0
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * VirtualBox OSE distribution, in which case the provisions of the
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * CDDL are applicable instead of those of the GPL.
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync *
e7aa635d70dd0cdf083287ec896fe8cca2775466vboxsync * You may elect to license modified versions of this file under the
e7aa635d70dd0cdf083287ec896fe8cca2775466vboxsync * terms and conditions of either the GPL or the CDDL or both.
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync *
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync * additional information or have any questions.
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync */
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync/*******************************************************************************
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync* Header Files *
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync*******************************************************************************/
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync#include <iprt/base64.h>
0b689b4143f8a4f8fcbc2d80782572b2956c2ff8vboxsync#include <iprt/err.h>
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync#include <iprt/initterm.h>
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync#include <iprt/stream.h>
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync#include <iprt/string.h>
0b689b4143f8a4f8fcbc2d80782572b2956c2ff8vboxsync#include <iprt/stdarg.h>
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync/*******************************************************************************
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync* Defined Constants And Macros *
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync*******************************************************************************/
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync#if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync# define MY_NL "\r\n"
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync#else
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync# define MY_NL "\n"
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync#endif
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync/*******************************************************************************
0b689b4143f8a4f8fcbc2d80782572b2956c2ff8vboxsync* Global Variables *
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync*******************************************************************************/
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsyncstatic int g_cErrors = 0;
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync
13fdd42f1fc3e519650037a920e6a54c24973866vboxsyncstatic void tstBase64(const void *pvData, size_t cbData, const char *pszEnc, size_t cchEnc,
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync int fTextData, int fNormalEnc, const char *pszTestFmt, ...)
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync{
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync char szOut[0x10000];
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync size_t cchOut = 0;
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync /* Format the test name first. */
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync va_list va;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync va_start(va, pszTestFmt);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync char szTest[32];
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTStrPrintfV(szTest, sizeof(szTest), pszTestFmt, va);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync va_end(va);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync /*
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync * Test decoding.
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync */
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync int rc = RTBase64Decode(pszEnc, szOut, cbData, &cchOut, NULL);
9afa6c5f4f1d021b1c7d066967ed02037fb14c42vboxsync if (RT_FAILURE(rc))
9afa6c5f4f1d021b1c7d066967ed02037fb14c42vboxsync {
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTPrintf("tstBase64: FAILURE - %s: RTBase64Decode -> %Rrc\n", szTest, rc);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync g_cErrors++;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync }
9afa6c5f4f1d021b1c7d066967ed02037fb14c42vboxsync else if (cchOut != cbData)
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync {
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTPrintf("tstBase64: FAILURE - %s: RTBase64Decode returned %zu bytes, expected %zu.\n",
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync szTest, cchOut, cbData);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync g_cErrors++;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync }
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync else if (memcmp(szOut, pvData, cchOut))
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync {
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync if (fTextData)
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTPrintf("tstBase64: FAILURE - %s: RTBase64Decode returned:\n%.*s\nexpected:\n%s\n",
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync szTest, (int)cchOut, szOut, pvData);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync else
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTPrintf("tstBase64: FAILURE - %s: RTBase64Decode return mismatching output\n", szTest);
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync g_cErrors++;
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync }
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync cchOut = RTBase64DecodedSize(pszEnc, NULL);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync if (cchOut != cbData)
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync {
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTPrintf("tstBase64: FAILURE - %s: RTBase64DecodedSize returned %zu bytes, expected %zu.\n",
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync szTest, cchOut, cbData);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync g_cErrors++;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync }
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync /*
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * Test encoding.
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync */
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync rc = RTBase64Encode(pvData, cbData, szOut, cchEnc + 1, &cchOut);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync if (RT_FAILURE(rc))
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync {
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTPrintf("tstBase64: FAILURE - %s: RTBase64Encode -> %Rrc\n", szTest, rc);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync g_cErrors++;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync }
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync else if (fNormalEnc && cchOut != cchEnc)
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync {
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTPrintf("tstBase64: FAILURE - %s: RTBase64Encode returned %zu bytes, expected %zu.\n",
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync szTest, cchOut, cchEnc);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync g_cErrors++;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync }
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync else if (fNormalEnc && memcmp(szOut, pszEnc, cchOut + 1))
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync {
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTPrintf("tstBase64: FAILURE - %s: RTBase64Encode returned:\n%*s\nexpected:\n%s\n",
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync szTest, szOut, pszEnc);
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync g_cErrors++;
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync }
aa9eecc1b20f1a9d5ef527d054af454a08879a9dvboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync size_t cchOut2 = RTBase64EncodedLength(cbData);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync if (cchOut != cchOut2)
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync {
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTPrintf("tstBase64: FAILURE - %s: RTBase64EncodedLength returned %zu bytes, expected %zu.\n",
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync szTest, cchOut2, cchOut);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync g_cErrors++;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync }
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync /** @todo negative testing. */
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync}
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsyncint main()
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync{
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTR3Init();
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync /*
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync * Series of simple tests.
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync */
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTPrintf("tstBase64: TESTING - Test 1\n");
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync static const struct
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync {
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync const char *pszText;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync size_t cchText;
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync const char *pszEnc;
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync size_t cchEnc;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync } g_aTests[] =
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync {
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync#define TEST_ENTRY(szText, szEnc) { szText, sizeof(szText) - 1, szEnc, sizeof(szEnc) - 1 }
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync TEST_ENTRY("Hey", "SGV5"),
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync TEST_ENTRY("Base64", "QmFzZTY0"),
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync TEST_ENTRY("Call me Ishmael.", "Q2FsbCBtZSBJc2htYWVsLg=="),
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync TEST_ENTRY(
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "Man is distinguished, not only by his reason, but by this singular passion "
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "from other animals, which is a lust of the mind, that by a perseverance of "
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "delight in the continued and indefatigable generation of knowledge, exceeds "
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "the short vehemence of any carnal pleasure." /* Thomas Hobbes's Leviathan */,
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFu" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "Y2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxl" MY_NL
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync "IGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhl" MY_NL
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync "bWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4="
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync )
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync#undef TEST_ENTRY
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync };
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync for (unsigned i = 0; i < RT_ELEMENTS(g_aTests); i++)
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync tstBase64(g_aTests[i].pszText, g_aTests[i].cchText,
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync g_aTests[i].pszEnc, g_aTests[i].cchEnc,
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync 1 /* fTextData */, 1 /* fNormalEnc */, "Test 1-#u", i);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync /*
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * Try with some more junk in the encoding and different line length.
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync */
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTPrintf("tstBase64: TESTING - Test 2\n");
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync static const char s_szText2[] =
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "Man is distinguished, not only by his reason, but by this singular passion "
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "from other animals, which is a lust of the mind, that by a perseverance of "
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "delight in the continued and indefatigable generation of knowledge, exceeds "
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "the short vehemence of any carnal pleasure."; /* Thomas Hobbes's Leviathan */
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync static const char s_szEnc2[] =
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync " TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz\r\n"
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync " IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg\n\r\t\t\t\v"
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu\n"
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "\tdWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo\n\r"
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync " ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=\n \n \r \n \t";
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync tstBase64(s_szText2, sizeof(s_szText2) - 1,
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync s_szEnc2, sizeof(s_szEnc2) - 1,
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync 1 /* fTextData */, 0 /* fNormalEnc */, "Test 2");
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync /*
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync * Finally, a more extensive test.
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync */
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync RTPrintf("tstBase64: TESTING - Test 3\n");
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync static uint8_t s_abData3[12*256];
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync for (unsigned i = 0; i < 256; i++)
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync {
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync unsigned j = i*12;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync s_abData3[j + 0] = i; /* */
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync s_abData3[j + 1] = 0xff;
a3b6aa2acb28aef68fc52cff45df4ac6d4a2655dvboxsync s_abData3[j + 2] = i;
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync s_abData3[j + 3] = 0xff; /* */
aa9eecc1b20f1a9d5ef527d054af454a08879a9dvboxsync s_abData3[j + 4] = i;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync s_abData3[j + 5] = 0xff;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync s_abData3[j + 6] = i; /* */
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync s_abData3[j + 7] = 0x00;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync s_abData3[j + 8] = i;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync s_abData3[j + 9] = 0x00; /* */
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync s_abData3[j + 10]= i;
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync s_abData3[j + 11]= 0x00;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync }
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync static const char s_szEnc3[] =
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync "AP8A/wD/AAAAAAAAAf8B/wH/AQABAAEAAv8C/wL/AgACAAIAA/8D/wP/AwADAAMA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "BP8E/wT/BAAEAAQABf8F/wX/BQAFAAUABv8G/wb/BgAGAAYAB/8H/wf/BwAHAAcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "CP8I/wj/CAAIAAgACf8J/wn/CQAJAAkACv8K/wr/CgAKAAoAC/8L/wv/CwALAAsA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "DP8M/wz/DAAMAAwADf8N/w3/DQANAA0ADv8O/w7/DgAOAA4AD/8P/w//DwAPAA8A" MY_NL
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync "EP8Q/xD/EAAQABAAEf8R/xH/EQARABEAEv8S/xL/EgASABIAE/8T/xP/EwATABMA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "FP8U/xT/FAAUABQAFf8V/xX/FQAVABUAFv8W/xb/FgAWABYAF/8X/xf/FwAXABcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "GP8Y/xj/GAAYABgAGf8Z/xn/GQAZABkAGv8a/xr/GgAaABoAG/8b/xv/GwAbABsA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "HP8c/xz/HAAcABwAHf8d/x3/HQAdAB0AHv8e/x7/HgAeAB4AH/8f/x//HwAfAB8A" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "IP8g/yD/IAAgACAAIf8h/yH/IQAhACEAIv8i/yL/IgAiACIAI/8j/yP/IwAjACMA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "JP8k/yT/JAAkACQAJf8l/yX/JQAlACUAJv8m/yb/JgAmACYAJ/8n/yf/JwAnACcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "KP8o/yj/KAAoACgAKf8p/yn/KQApACkAKv8q/yr/KgAqACoAK/8r/yv/KwArACsA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "LP8s/yz/LAAsACwALf8t/y3/LQAtAC0ALv8u/y7/LgAuAC4AL/8v/y//LwAvAC8A" MY_NL
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync "MP8w/zD/MAAwADAAMf8x/zH/MQAxADEAMv8y/zL/MgAyADIAM/8z/zP/MwAzADMA" MY_NL
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync "NP80/zT/NAA0ADQANf81/zX/NQA1ADUANv82/zb/NgA2ADYAN/83/zf/NwA3ADcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "OP84/zj/OAA4ADgAOf85/zn/OQA5ADkAOv86/zr/OgA6ADoAO/87/zv/OwA7ADsA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "PP88/zz/PAA8ADwAPf89/z3/PQA9AD0APv8+/z7/PgA+AD4AP/8//z//PwA/AD8A" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "QP9A/0D/QABAAEAAQf9B/0H/QQBBAEEAQv9C/0L/QgBCAEIAQ/9D/0P/QwBDAEMA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "RP9E/0T/RABEAEQARf9F/0X/RQBFAEUARv9G/0b/RgBGAEYAR/9H/0f/RwBHAEcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "SP9I/0j/SABIAEgASf9J/0n/SQBJAEkASv9K/0r/SgBKAEoAS/9L/0v/SwBLAEsA" MY_NL
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync "TP9M/0z/TABMAEwATf9N/03/TQBNAE0ATv9O/07/TgBOAE4AT/9P/0//TwBPAE8A" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "UP9Q/1D/UABQAFAAUf9R/1H/UQBRAFEAUv9S/1L/UgBSAFIAU/9T/1P/UwBTAFMA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "VP9U/1T/VABUAFQAVf9V/1X/VQBVAFUAVv9W/1b/VgBWAFYAV/9X/1f/VwBXAFcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "WP9Y/1j/WABYAFgAWf9Z/1n/WQBZAFkAWv9a/1r/WgBaAFoAW/9b/1v/WwBbAFsA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "XP9c/1z/XABcAFwAXf9d/13/XQBdAF0AXv9e/17/XgBeAF4AX/9f/1//XwBfAF8A" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "YP9g/2D/YABgAGAAYf9h/2H/YQBhAGEAYv9i/2L/YgBiAGIAY/9j/2P/YwBjAGMA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "ZP9k/2T/ZABkAGQAZf9l/2X/ZQBlAGUAZv9m/2b/ZgBmAGYAZ/9n/2f/ZwBnAGcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "aP9o/2j/aABoAGgAaf9p/2n/aQBpAGkAav9q/2r/agBqAGoAa/9r/2v/awBrAGsA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "bP9s/2z/bABsAGwAbf9t/23/bQBtAG0Abv9u/27/bgBuAG4Ab/9v/2//bwBvAG8A" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "cP9w/3D/cABwAHAAcf9x/3H/cQBxAHEAcv9y/3L/cgByAHIAc/9z/3P/cwBzAHMA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "dP90/3T/dAB0AHQAdf91/3X/dQB1AHUAdv92/3b/dgB2AHYAd/93/3f/dwB3AHcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "eP94/3j/eAB4AHgAef95/3n/eQB5AHkAev96/3r/egB6AHoAe/97/3v/ewB7AHsA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "fP98/3z/fAB8AHwAff99/33/fQB9AH0Afv9+/37/fgB+AH4Af/9//3//fwB/AH8A" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "gP+A/4D/gACAAIAAgf+B/4H/gQCBAIEAgv+C/4L/ggCCAIIAg/+D/4P/gwCDAIMA" MY_NL
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync "hP+E/4T/hACEAIQAhf+F/4X/hQCFAIUAhv+G/4b/hgCGAIYAh/+H/4f/hwCHAIcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "iP+I/4j/iACIAIgAif+J/4n/iQCJAIkAiv+K/4r/igCKAIoAi/+L/4v/iwCLAIsA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "jP+M/4z/jACMAIwAjf+N/43/jQCNAI0Ajv+O/47/jgCOAI4Aj/+P/4//jwCPAI8A" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "kP+Q/5D/kACQAJAAkf+R/5H/kQCRAJEAkv+S/5L/kgCSAJIAk/+T/5P/kwCTAJMA" MY_NL
1804358f1a69e31cd294ba3035ef187d18d248e5vboxsync "lP+U/5T/lACUAJQAlf+V/5X/lQCVAJUAlv+W/5b/lgCWAJYAl/+X/5f/lwCXAJcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "mP+Y/5j/mACYAJgAmf+Z/5n/mQCZAJkAmv+a/5r/mgCaAJoAm/+b/5v/mwCbAJsA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "nP+c/5z/nACcAJwAnf+d/53/nQCdAJ0Anv+e/57/ngCeAJ4An/+f/5//nwCfAJ8A" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "oP+g/6D/oACgAKAAof+h/6H/oQChAKEAov+i/6L/ogCiAKIAo/+j/6P/owCjAKMA" MY_NL
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync "pP+k/6T/pACkAKQApf+l/6X/pQClAKUApv+m/6b/pgCmAKYAp/+n/6f/pwCnAKcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "qP+o/6j/qACoAKgAqf+p/6n/qQCpAKkAqv+q/6r/qgCqAKoAq/+r/6v/qwCrAKsA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "rP+s/6z/rACsAKwArf+t/63/rQCtAK0Arv+u/67/rgCuAK4Ar/+v/6//rwCvAK8A" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "sP+w/7D/sACwALAAsf+x/7H/sQCxALEAsv+y/7L/sgCyALIAs/+z/7P/swCzALMA" MY_NL
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync "tP+0/7T/tAC0ALQAtf+1/7X/tQC1ALUAtv+2/7b/tgC2ALYAt/+3/7f/twC3ALcA" MY_NL
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync "uP+4/7j/uAC4ALgAuf+5/7n/uQC5ALkAuv+6/7r/ugC6ALoAu/+7/7v/uwC7ALsA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "vP+8/7z/vAC8ALwAvf+9/73/vQC9AL0Avv++/77/vgC+AL4Av/+//7//vwC/AL8A" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "wP/A/8D/wADAAMAAwf/B/8H/wQDBAMEAwv/C/8L/wgDCAMIAw//D/8P/wwDDAMMA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "xP/E/8T/xADEAMQAxf/F/8X/xQDFAMUAxv/G/8b/xgDGAMYAx//H/8f/xwDHAMcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "yP/I/8j/yADIAMgAyf/J/8n/yQDJAMkAyv/K/8r/ygDKAMoAy//L/8v/ywDLAMsA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "zP/M/8z/zADMAMwAzf/N/83/zQDNAM0Azv/O/87/zgDOAM4Az//P/8//zwDPAM8A" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "0P/Q/9D/0ADQANAA0f/R/9H/0QDRANEA0v/S/9L/0gDSANIA0//T/9P/0wDTANMA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "1P/U/9T/1ADUANQA1f/V/9X/1QDVANUA1v/W/9b/1gDWANYA1//X/9f/1wDXANcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "2P/Y/9j/2ADYANgA2f/Z/9n/2QDZANkA2v/a/9r/2gDaANoA2//b/9v/2wDbANsA" MY_NL
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync "3P/c/9z/3ADcANwA3f/d/93/3QDdAN0A3v/e/97/3gDeAN4A3//f/9//3wDfAN8A" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "4P/g/+D/4ADgAOAA4f/h/+H/4QDhAOEA4v/i/+L/4gDiAOIA4//j/+P/4wDjAOMA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "5P/k/+T/5ADkAOQA5f/l/+X/5QDlAOUA5v/m/+b/5gDmAOYA5//n/+f/5wDnAOcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "6P/o/+j/6ADoAOgA6f/p/+n/6QDpAOkA6v/q/+r/6gDqAOoA6//r/+v/6wDrAOsA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "7P/s/+z/7ADsAOwA7f/t/+3/7QDtAO0A7v/u/+7/7gDuAO4A7//v/+//7wDvAO8A" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "8P/w//D/8ADwAPAA8f/x//H/8QDxAPEA8v/y//L/8gDyAPIA8//z//P/8wDzAPMA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "9P/0//T/9AD0APQA9f/1//X/9QD1APUA9v/2//b/9gD2APYA9//3//f/9wD3APcA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "+P/4//j/+AD4APgA+f/5//n/+QD5APkA+v/6//r/+gD6APoA+//7//v/+wD7APsA" MY_NL
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync "/P/8//z//AD8APwA/f/9//3//QD9AP0A/v/+//7//gD+AP4A/////////wD/AP8A";
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync tstBase64(s_abData3, sizeof(s_abData3),
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync s_szEnc3, sizeof(s_szEnc3) - 1,
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync 0 /* fTextData */, 0 /* fNormalEnc */, "Test 3");
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync /*
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync * Summary.
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync */
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync if (!g_cErrors)
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTPrintf("tstBase64: SUCCESS\n");
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync else
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync RTPrintf("tstBase64: FAILURE - %d errors\n", g_cErrors);
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync return !!g_cErrors;
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync}
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync
60d03c38311c6e4c34add74be472fe2098f52d6evboxsync