parent
a30647d32e
commit
cb627980a5
16 changed files with 0 additions and 1958 deletions
|
|
@ -207,7 +207,6 @@ set( fc_sources
|
||||||
src/crypto/aes.cpp
|
src/crypto/aes.cpp
|
||||||
src/crypto/crc.cpp
|
src/crypto/crc.cpp
|
||||||
src/crypto/city.cpp
|
src/crypto/city.cpp
|
||||||
src/crypto/base32.cpp
|
|
||||||
src/crypto/base36.cpp
|
src/crypto/base36.cpp
|
||||||
src/crypto/base58.cpp
|
src/crypto/base58.cpp
|
||||||
src/crypto/base64.cpp
|
src/crypto/base64.cpp
|
||||||
|
|
@ -235,8 +234,6 @@ set( fc_sources
|
||||||
src/network/url.cpp
|
src/network/url.cpp
|
||||||
src/compress/smaz.cpp
|
src/compress/smaz.cpp
|
||||||
src/compress/zlib.cpp
|
src/compress/zlib.cpp
|
||||||
vendor/cyoencode-1.0.2/src/CyoDecode.c
|
|
||||||
vendor/cyoencode-1.0.2/src/CyoEncode.c
|
|
||||||
)
|
)
|
||||||
|
|
||||||
file( GLOB_RECURSE fc_headers ${CMAKE_CURRENT_SOURCE_DIR} *.hpp *.h )
|
file( GLOB_RECURSE fc_headers ${CMAKE_CURRENT_SOURCE_DIR} *.hpp *.h )
|
||||||
|
|
@ -369,7 +366,6 @@ target_include_directories(fc
|
||||||
|
|
||||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/vendor/boost_1.51/include
|
${CMAKE_CURRENT_SOURCE_DIR}/vendor/boost_1.51/include
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/vendor/cyoencode-1.0.2/src
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp
|
${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <fc/vector.hpp>
|
|
||||||
#include <fc/string.hpp>
|
|
||||||
|
|
||||||
namespace fc
|
|
||||||
{
|
|
||||||
std::vector<char> from_base32( const fc::string& b32 );
|
|
||||||
fc::string to_base32( const std::vector<char>& vec );
|
|
||||||
fc::string to_base32( const char* data, size_t len );
|
|
||||||
}
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
#include <fc/crypto/base32.hpp>
|
|
||||||
#include <CyoDecode.h>
|
|
||||||
#include <CyoEncode.h>
|
|
||||||
namespace fc
|
|
||||||
{
|
|
||||||
std::vector<char> from_base32( const std::string& b32 )
|
|
||||||
{
|
|
||||||
auto len = cyoBase32DecodeGetLength( b32.size() );
|
|
||||||
std::vector<char> v(len);
|
|
||||||
len = cyoBase32Decode( v.data(), b32.c_str(), b32.size() );
|
|
||||||
v.resize( len );
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string to_base32( const char* data, size_t len )
|
|
||||||
{
|
|
||||||
auto s = cyoBase32EncodeGetLength(len);
|
|
||||||
std::vector<char> b32;
|
|
||||||
b32.resize(s);
|
|
||||||
cyoBase32Encode( b32.data(), data, len );
|
|
||||||
b32.resize( b32.size()-1); // strip the nullterm
|
|
||||||
return std::string(b32.begin(),b32.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string to_base32( const std::vector<char>& vec )
|
|
||||||
{
|
|
||||||
return to_base32( vec.data(), vec.size() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
#include <fc/crypto/hex.hpp>
|
#include <fc/crypto/hex.hpp>
|
||||||
#include <fc/crypto/base32.hpp>
|
|
||||||
#include <fc/crypto/base36.hpp>
|
#include <fc/crypto/base36.hpp>
|
||||||
#include <fc/crypto/base58.hpp>
|
#include <fc/crypto/base58.hpp>
|
||||||
#include <fc/crypto/base64.hpp>
|
#include <fc/crypto/base64.hpp>
|
||||||
|
|
@ -44,29 +43,6 @@ BOOST_AUTO_TEST_CASE(hex_test)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void test_32( const std::string& test, const std::string& expected )
|
|
||||||
{
|
|
||||||
std::vector<char> vec( test.begin(), test.end() );
|
|
||||||
fc::string enc1 = fc::to_base32( vec );
|
|
||||||
fc::string enc2 = fc::to_base32( test.c_str(), test.size() );
|
|
||||||
BOOST_CHECK_EQUAL( enc1, enc2 );
|
|
||||||
BOOST_CHECK_EQUAL( expected, enc2 );
|
|
||||||
|
|
||||||
std::vector<char> dec = fc::from_base32( enc1 );
|
|
||||||
BOOST_CHECK_EQUAL( vec.size(), dec.size() );
|
|
||||||
BOOST_CHECK( !memcmp( vec.data(), dec.data(), vec.size() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(base32_test)
|
|
||||||
{
|
|
||||||
test_32( TEST1, "" );
|
|
||||||
test_32( TEST2, "AAATAMI=" );
|
|
||||||
test_32( TEST3, "IFBEGRCFIZDUQSKKJNGE2TSPKBIVEU2UKVLFOWCZLI======" );
|
|
||||||
test_32( TEST4, "777AB7IB7Q======" );
|
|
||||||
test_32( TEST5, "AAAAA===" );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void test_36( const std::string& test, const std::string& expected )
|
static void test_36( const std::string& test, const std::string& expected )
|
||||||
{
|
{
|
||||||
std::vector<char> vec( test.begin(), test.end() );
|
std::vector<char> vec( test.begin(), test.end() );
|
||||||
|
|
|
||||||
27
vendor/cyoencode-1.0.2/LICENSE.TXT
vendored
27
vendor/cyoencode-1.0.2/LICENSE.TXT
vendored
|
|
@ -1,27 +0,0 @@
|
||||||
All the files in this library are covered under the terms of the Berkeley
|
|
||||||
Software Distribution (BSD) License:
|
|
||||||
|
|
||||||
Copyright (c) 2009-2012, Graham Bull.
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
50
vendor/cyoencode-1.0.2/README.TXT
vendored
50
vendor/cyoencode-1.0.2/README.TXT
vendored
|
|
@ -1,50 +0,0 @@
|
||||||
===============================================================================
|
|
||||||
CyoEncode
|
|
||||||
http://cyoencode.sourceforge.net/
|
|
||||||
|
|
||||||
Copyright (c) 2009-2012, Graham Bull. All rights reserved.
|
|
||||||
===============================================================================
|
|
||||||
|
|
||||||
Version 1.0.2
|
|
||||||
Release Date 5th January 2012
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
1. License
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
CyoEncode is made available under the terms of the Berkeley Software
|
|
||||||
Distribution (BSD) licence, as detailed in LICENSE.TXT. This allows you
|
|
||||||
complete freedom to use and distribute the code in source and/or binary form,
|
|
||||||
as long as you respect the original copyright.
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
2. Instructions
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Simply copy the required source files (CyoEncode.h/cpp and CyoDecode.h/cpp)
|
|
||||||
into your C/C++ project.
|
|
||||||
|
|
||||||
Examples of usage can be found in the test.c file.
|
|
||||||
|
|
||||||
For Unix/Linux developers, there's a shell script that will build the test
|
|
||||||
using GCC.
|
|
||||||
|
|
||||||
For Windows developers, Visual Studio projects are included.
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
3. Release Notes
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
1.0.2 - 5th January 2012
|
|
||||||
- A little refactoring, added some shared functions.
|
|
||||||
- Added VS42010 project file.
|
|
||||||
- Added x64 build configurations.
|
|
||||||
|
|
||||||
1.0.1 - 25th September 2009
|
|
||||||
- Added the cyoBase??Validate() functions.
|
|
||||||
- Added detection of invalid encodings in the cyoBase??Decode() functions,
|
|
||||||
rather than relying on assertions.
|
|
||||||
|
|
||||||
1.0.0 - 19th August 2009
|
|
||||||
- First release.
|
|
||||||
|
|
||||||
398
vendor/cyoencode-1.0.2/src/CyoDecode.c
vendored
398
vendor/cyoencode-1.0.2/src/CyoDecode.c
vendored
|
|
@ -1,398 +0,0 @@
|
||||||
/*
|
|
||||||
* CyoDecode.c - part of the CyoEncode library
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-2012, Graham Bull.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "CyoDecode.h"
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include <stdio.h> //TEMP
|
|
||||||
|
|
||||||
/********************************** Shared ***********************************/
|
|
||||||
|
|
||||||
static int cyoBaseXXValidate( const char* src, size_t size, size_t inputBytes, size_t maxPadding,
|
|
||||||
unsigned char maxValue, const unsigned char table[] )
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* returns 0 if the source is a valid baseXX encoding
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!src)
|
|
||||||
return -1; /*ERROR - NULL pointer*/
|
|
||||||
|
|
||||||
if (size % inputBytes != 0)
|
|
||||||
return -1; /*ERROR - extra characters*/
|
|
||||||
|
|
||||||
/* check the bytes */
|
|
||||||
for (; size >= 1; --size, ++src)
|
|
||||||
{
|
|
||||||
unsigned char ch = *src;
|
|
||||||
if ((ch >= 0x80) || (table[ ch ] > maxValue))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check any padding */
|
|
||||||
for (; 1 <= size && size <= maxPadding; --size, ++src)
|
|
||||||
{
|
|
||||||
unsigned char ch = *src;
|
|
||||||
if ((ch >= 0x80) || (table[ ch ] != maxValue + 1))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if size isn't zero then the encoded string isn't valid */
|
|
||||||
if (size != 0)
|
|
||||||
return -2; /*ERROR - invalid baseXX character*/
|
|
||||||
|
|
||||||
/* OK */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static size_t cyoBaseXXDecodeGetLength( size_t size, size_t inputBytes, size_t outputBytes )
|
|
||||||
{
|
|
||||||
if (size % inputBytes != 0)
|
|
||||||
return 0; /*ERROR - extra characters*/
|
|
||||||
|
|
||||||
/* OK */
|
|
||||||
return (((size + inputBytes - 1) / inputBytes) * outputBytes) + 1; /*plus terminator*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************** Base16 Decoding ******************************/
|
|
||||||
|
|
||||||
static const size_t BASE16_INPUT = 2;
|
|
||||||
static const size_t BASE16_OUTPUT = 1;
|
|
||||||
static const size_t BASE16_MAX_PADDING = 0;
|
|
||||||
static const unsigned char BASE16_MAX_VALUE = 15;
|
|
||||||
static const unsigned char BASE16_TABLE[ 0x80 ] = {
|
|
||||||
/*00-07*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*08-0f*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*10-17*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*18-1f*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*20-27*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*28-2f*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*30-37*/ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /*8 = '0'-'7'*/
|
|
||||||
/*38-3f*/ 0x08, 0x09, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /*2 = '8'-'9'*/
|
|
||||||
/*40-47*/ 0xFF, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xFF, /*6 = 'A'-'F'*/
|
|
||||||
/*48-4f*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*50-57*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*58-5f*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*60-67*/ 0xFF, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xFF, /*6 = 'a'-'f' (same as 'A'-'F')*/
|
|
||||||
/*68-6f*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*70-77*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*78-7f*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
|
||||||
};
|
|
||||||
|
|
||||||
int cyoBase16Validate( const char* src, size_t size )
|
|
||||||
{
|
|
||||||
return cyoBaseXXValidate( src, size, BASE16_INPUT, BASE16_MAX_PADDING, BASE16_MAX_VALUE, BASE16_TABLE );
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t cyoBase16DecodeGetLength( size_t size )
|
|
||||||
{
|
|
||||||
return cyoBaseXXDecodeGetLength( size, BASE16_INPUT, BASE16_OUTPUT );
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t cyoBase16Decode( void* dest, const char* src, size_t size )
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* output 1 byte for every 2 input:
|
|
||||||
*
|
|
||||||
* outputs: 1
|
|
||||||
* inputs: 1 = ----1111 = 1111----
|
|
||||||
* 2 = ----2222 = ----2222
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (dest && src && (size % BASE16_INPUT == 0))
|
|
||||||
{
|
|
||||||
unsigned char* pDest = (unsigned char*)dest;
|
|
||||||
size_t dwSrcSize = size;
|
|
||||||
size_t dwDestSize = 0;
|
|
||||||
unsigned char in1, in2;
|
|
||||||
|
|
||||||
while (dwSrcSize >= 1)
|
|
||||||
{
|
|
||||||
/* 2 inputs */
|
|
||||||
in1 = *src++;
|
|
||||||
in2 = *src++;
|
|
||||||
dwSrcSize -= BASE16_INPUT;
|
|
||||||
|
|
||||||
/* Validate ascii */
|
|
||||||
if (in1 >= 0x80 || in2 >= 0x80)
|
|
||||||
return 0; /*ERROR - invalid base16 character*/
|
|
||||||
|
|
||||||
/* Convert ascii to base16 */
|
|
||||||
in1 = BASE16_TABLE[ in1 ];
|
|
||||||
in2 = BASE16_TABLE[ in2 ];
|
|
||||||
|
|
||||||
/* Validate base16 */
|
|
||||||
if (in1 > BASE16_MAX_VALUE || in2 > BASE16_MAX_VALUE)
|
|
||||||
return 0; /*ERROR - invalid base16 character*/
|
|
||||||
|
|
||||||
/* 1 output */
|
|
||||||
*pDest++ = ((in1 << 4) | in2);
|
|
||||||
dwDestSize += BASE16_OUTPUT;
|
|
||||||
}
|
|
||||||
*pDest++ = '\x0'; /*append terminator*/
|
|
||||||
|
|
||||||
return dwDestSize;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 0; /*ERROR - null pointer, or size isn't a multiple of 2*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************** Base32 Decoding ******************************/
|
|
||||||
|
|
||||||
static const size_t BASE32_INPUT = 8;
|
|
||||||
static const size_t BASE32_OUTPUT = 5;
|
|
||||||
static const size_t BASE32_MAX_PADDING = 6;
|
|
||||||
static const unsigned char BASE32_MAX_VALUE = 31;
|
|
||||||
static const unsigned char BASE32_TABLE[ 0x80 ] = {
|
|
||||||
/*00-07*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*08-0f*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*10-17*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*18-1f*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*20-27*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*28-2f*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*30-37*/ 0xFF, 0xFF, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /*6 = '2'-'7'*/
|
|
||||||
/*38-3f*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x20, 0xFF, 0xFF, /*1 = '='*/
|
|
||||||
/*40-47*/ 0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, /*7 = 'A'-'G'*/
|
|
||||||
/*48-4f*/ 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, /*8 = 'H'-'O'*/
|
|
||||||
/*50-57*/ 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, /*8 = 'P'-'W'*/
|
|
||||||
/*58-5f*/ 0x17, 0x18, 0x19, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /*3 = 'X'-'Z'*/
|
|
||||||
/*60-67*/ 0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, /*7 = 'a'-'g' (same as 'A'-'G')*/
|
|
||||||
/*68-6f*/ 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, /*8 = 'h'-'o' (same as 'H'-'O')*/
|
|
||||||
/*70-77*/ 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, /*8 = 'p'-'w' (same as 'P'-'W')*/
|
|
||||||
/*78-7f*/ 0x17, 0x18, 0x19, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF /*3 = 'x'-'z' (same as 'X'-'Z')*/
|
|
||||||
};
|
|
||||||
|
|
||||||
int cyoBase32Validate( const char* src, size_t size )
|
|
||||||
{
|
|
||||||
return cyoBaseXXValidate( src, size, BASE32_INPUT, BASE32_MAX_PADDING, BASE32_MAX_VALUE, BASE32_TABLE );
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t cyoBase32DecodeGetLength( size_t size )
|
|
||||||
{
|
|
||||||
return cyoBaseXXDecodeGetLength( size, BASE32_INPUT, BASE32_OUTPUT );
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t cyoBase32Decode( void* dest, const char* src, size_t size )
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* output 5 bytes for every 8 input:
|
|
||||||
*
|
|
||||||
* outputs: 1 2 3 4 5
|
|
||||||
* inputs: 1 = ---11111 = 11111---
|
|
||||||
* 2 = ---222XX = -----222 XX------
|
|
||||||
* 3 = ---33333 = --33333-
|
|
||||||
* 4 = ---4XXXX = -------4 XXXX----
|
|
||||||
* 5 = ---5555X = ----5555 X-------
|
|
||||||
* 6 = ---66666 = -66666--
|
|
||||||
* 7 = ---77XXX = ------77 XXX-----
|
|
||||||
* 8 = ---88888 = ---88888
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (dest && src && (size % BASE32_INPUT == 0))
|
|
||||||
{
|
|
||||||
unsigned char* pDest = (unsigned char*)dest;
|
|
||||||
size_t dwSrcSize = size;
|
|
||||||
size_t dwDestSize = 0;
|
|
||||||
unsigned char in1, in2, in3, in4, in5, in6, in7, in8;
|
|
||||||
|
|
||||||
while (dwSrcSize >= 1)
|
|
||||||
{
|
|
||||||
/* 8 inputs */
|
|
||||||
in1 = *src++;
|
|
||||||
in2 = *src++;
|
|
||||||
in3 = *src++;
|
|
||||||
in4 = *src++;
|
|
||||||
in5 = *src++;
|
|
||||||
in6 = *src++;
|
|
||||||
in7 = *src++;
|
|
||||||
in8 = *src++;
|
|
||||||
dwSrcSize -= BASE32_INPUT;
|
|
||||||
|
|
||||||
/* Validate ascii */
|
|
||||||
if ( in1 >= 0x80 || in2 >= 0x80 || in3 >= 0x80 || in4 >= 0x80
|
|
||||||
|| in5 >= 0x80 || in6 >= 0x80 || in7 >= 0x80 || in8 >= 0x80)
|
|
||||||
return 0; /*ERROR - invalid base32 character*/
|
|
||||||
|
|
||||||
/* Convert ascii to base16 */
|
|
||||||
in1 = BASE32_TABLE[ in1 ];
|
|
||||||
in2 = BASE32_TABLE[ in2 ];
|
|
||||||
in3 = BASE32_TABLE[ in3 ];
|
|
||||||
in4 = BASE32_TABLE[ in4 ];
|
|
||||||
in5 = BASE32_TABLE[ in5 ];
|
|
||||||
in6 = BASE32_TABLE[ in6 ];
|
|
||||||
in7 = BASE32_TABLE[ in7 ];
|
|
||||||
in8 = BASE32_TABLE[ in8 ];
|
|
||||||
|
|
||||||
/* Validate base32 */
|
|
||||||
if (in1 > BASE32_MAX_VALUE || in2 > BASE32_MAX_VALUE)
|
|
||||||
return 0; /*ERROR - invalid base32 character*/
|
|
||||||
/*the following can be padding*/
|
|
||||||
if ( in3 > BASE32_MAX_VALUE + 1 || in4 > BASE32_MAX_VALUE + 1 || in5 > BASE32_MAX_VALUE + 1
|
|
||||||
|| in6 > BASE32_MAX_VALUE + 1 || in7 > BASE32_MAX_VALUE + 1 || in8 > BASE32_MAX_VALUE + 1)
|
|
||||||
return 0; /*ERROR - invalid base32 character*/
|
|
||||||
|
|
||||||
/* 5 outputs */
|
|
||||||
*pDest++ = ((in1 & 0x1f) << 3) | ((in2 & 0x1c) >> 2);
|
|
||||||
*pDest++ = ((in2 & 0x03) << 6) | ((in3 & 0x1f) << 1) | ((in4 & 0x10) >> 4);
|
|
||||||
*pDest++ = ((in4 & 0x0f) << 4) | ((in5 & 0x1e) >> 1);
|
|
||||||
*pDest++ = ((in5 & 0x01) << 7) | ((in6 & 0x1f) << 2) | ((in7 & 0x18) >> 3);
|
|
||||||
*pDest++ = ((in7 & 0x07) << 5) | (in8 & 0x1f);
|
|
||||||
dwDestSize += BASE32_OUTPUT;
|
|
||||||
|
|
||||||
/* Padding */
|
|
||||||
if (in8 == BASE32_MAX_VALUE + 1)
|
|
||||||
{
|
|
||||||
--dwDestSize;
|
|
||||||
assert( (in7 == BASE32_MAX_VALUE + 1 && in6 == BASE32_MAX_VALUE + 1) || (in7 != BASE32_MAX_VALUE + 1) );
|
|
||||||
if (in6 == BASE32_MAX_VALUE + 1)
|
|
||||||
{
|
|
||||||
--dwDestSize;
|
|
||||||
if (in5 == BASE32_MAX_VALUE + 1)
|
|
||||||
{
|
|
||||||
--dwDestSize;
|
|
||||||
assert( (in4 == BASE32_MAX_VALUE + 1 && in3 == BASE32_MAX_VALUE + 1) || (in4 != BASE32_MAX_VALUE + 1) );
|
|
||||||
if (in3 == BASE32_MAX_VALUE + 1)
|
|
||||||
{
|
|
||||||
--dwDestSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*pDest++ = '\x0'; /*append terminator*/
|
|
||||||
|
|
||||||
return dwDestSize;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 0; /*ERROR - null pointer, or size isn't a multiple of 8*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************** Base64 Decoding ******************************/
|
|
||||||
|
|
||||||
static const size_t BASE64_INPUT = 4;
|
|
||||||
static const size_t BASE64_OUTPUT = 3;
|
|
||||||
static const size_t BASE64_MAX_PADDING = 2;
|
|
||||||
static const unsigned char BASE64_MAX_VALUE = 63;
|
|
||||||
static const unsigned char BASE64_TABLE[ 0x80 ] = {
|
|
||||||
/*00-07*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*08-0f*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*10-17*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*18-1f*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*20-27*/ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
/*28-2f*/ 0xFF, 0xFF, 0xFF, 0x3e, 0xFF, 0xFF, 0xFF, 0x3f, /*2 = '+' and '/'*/
|
|
||||||
/*30-37*/ 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, /*8 = '0'-'7'*/
|
|
||||||
/*38-3f*/ 0x3c, 0x3d, 0xFF, 0xFF, 0xFF, 0x40, 0xFF, 0xFF, /*2 = '8'-'9' and '='*/
|
|
||||||
/*40-47*/ 0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, /*7 = 'A'-'G'*/
|
|
||||||
/*48-4f*/ 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, /*8 = 'H'-'O'*/
|
|
||||||
/*50-57*/ 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, /*8 = 'P'-'W'*/
|
|
||||||
/*58-5f*/ 0x17, 0x18, 0x19, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /*3 = 'X'-'Z'*/
|
|
||||||
/*60-67*/ 0xFF, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, /*7 = 'a'-'g'*/
|
|
||||||
/*68-6f*/ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, /*8 = 'h'-'o'*/
|
|
||||||
/*70-77*/ 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, /*8 = 'p'-'w'*/
|
|
||||||
/*78-7f*/ 0x31, 0x32, 0x33, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF /*3 = 'x'-'z'*/
|
|
||||||
};
|
|
||||||
|
|
||||||
int cyoBase64Validate( const char* src, size_t size )
|
|
||||||
{
|
|
||||||
return cyoBaseXXValidate( src, size, BASE64_INPUT, BASE64_MAX_PADDING, BASE64_MAX_VALUE, BASE64_TABLE );
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t cyoBase64DecodeGetLength( size_t size )
|
|
||||||
{
|
|
||||||
return cyoBaseXXDecodeGetLength( size, BASE64_INPUT, BASE64_OUTPUT );
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t cyoBase64Decode( void* dest, const char* src, size_t size )
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* output 3 bytes for every 4 input:
|
|
||||||
*
|
|
||||||
* outputs: 1 2 3
|
|
||||||
* inputs: 1 = --111111 = 111111--
|
|
||||||
* 2 = --22XXXX = ------22 XXXX----
|
|
||||||
* 3 = --3333XX = ----3333 XX------
|
|
||||||
* 4 = --444444 = --444444
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (dest && src && (size % BASE64_INPUT == 0))
|
|
||||||
{
|
|
||||||
unsigned char* pDest = (unsigned char*)dest;
|
|
||||||
size_t dwSrcSize = size;
|
|
||||||
size_t dwDestSize = 0;
|
|
||||||
unsigned char in1, in2, in3, in4;
|
|
||||||
|
|
||||||
while (dwSrcSize >= 1)
|
|
||||||
{
|
|
||||||
/* 4 inputs */
|
|
||||||
in1 = *src++;
|
|
||||||
in2 = *src++;
|
|
||||||
in3 = *src++;
|
|
||||||
in4 = *src++;
|
|
||||||
dwSrcSize -= BASE64_INPUT;
|
|
||||||
|
|
||||||
/* Validate ascii */
|
|
||||||
if (in1 >= 0x80 || in2 >= 0x80 || in3 >= 0x80 || in4 >= 0x80)
|
|
||||||
return 0; /*ERROR - invalid base64 character*/
|
|
||||||
|
|
||||||
/* Convert ascii to base64 */
|
|
||||||
in1 = BASE64_TABLE[ in1 ];
|
|
||||||
in2 = BASE64_TABLE[ in2 ];
|
|
||||||
in3 = BASE64_TABLE[ in3 ];
|
|
||||||
in4 = BASE64_TABLE[ in4 ];
|
|
||||||
|
|
||||||
/* Validate base64 */
|
|
||||||
if (in1 > BASE64_MAX_VALUE || in2 > BASE64_MAX_VALUE)
|
|
||||||
return 0; /*ERROR - invalid base64 character*/
|
|
||||||
/*the following can be padding*/
|
|
||||||
if (in3 > BASE64_MAX_VALUE + 1 || in4 > BASE64_MAX_VALUE + 1)
|
|
||||||
return 0; /*ERROR - invalid base64 character*/
|
|
||||||
|
|
||||||
/* 3 outputs */
|
|
||||||
*pDest++ = ((in1 & 0x3f) << 2) | ((in2 & 0x30) >> 4);
|
|
||||||
*pDest++ = ((in2 & 0x0f) << 4) | ((in3 & 0x3c) >> 2);
|
|
||||||
*pDest++ = ((in3 & 0x03) << 6) | (in4 & 0x3f);
|
|
||||||
dwDestSize += BASE64_OUTPUT;
|
|
||||||
|
|
||||||
/* Padding */
|
|
||||||
if (in4 == BASE64_MAX_VALUE + 1)
|
|
||||||
{
|
|
||||||
--dwDestSize;
|
|
||||||
if (in3 == BASE64_MAX_VALUE + 1)
|
|
||||||
{
|
|
||||||
--dwDestSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*pDest++ = '\x0'; /*append terminator*/
|
|
||||||
|
|
||||||
return dwDestSize;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 0; /*ERROR - null pointer, or size isn't a multiple of 4*/
|
|
||||||
}
|
|
||||||
58
vendor/cyoencode-1.0.2/src/CyoDecode.h
vendored
58
vendor/cyoencode-1.0.2/src/CyoDecode.h
vendored
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
* CyoDecode.h - part of the CyoEncode library
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-2012, Graham Bull.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __CYODECODE_H
|
|
||||||
#define __CYODECODE_H
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Base16 Decoding */
|
|
||||||
int cyoBase16Validate( const char* src, size_t size );
|
|
||||||
size_t cyoBase16DecodeGetLength( size_t size );
|
|
||||||
size_t cyoBase16Decode( void* dest, const char* src, size_t size );
|
|
||||||
|
|
||||||
/* Base32 Decoding */
|
|
||||||
int cyoBase32Validate( const char* src, size_t size );
|
|
||||||
size_t cyoBase32DecodeGetLength( size_t size );
|
|
||||||
size_t cyoBase32Decode( void* dest, const char* src, size_t size );
|
|
||||||
|
|
||||||
/* Base64 Decoding */
|
|
||||||
int cyoBase64Validate( const char* src, size_t size );
|
|
||||||
size_t cyoBase64DecodeGetLength( size_t size );
|
|
||||||
size_t cyoBase64Decode( void* dest, const char* src, size_t size );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /*__CYODECODE_H*/
|
|
||||||
|
|
||||||
283
vendor/cyoencode-1.0.2/src/CyoEncode.c
vendored
283
vendor/cyoencode-1.0.2/src/CyoEncode.c
vendored
|
|
@ -1,283 +0,0 @@
|
||||||
/*
|
|
||||||
* CyoEncode.c - part of the CyoEncode library
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-2012, Graham Bull.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "CyoEncode.h"
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
/********************************** Shared ***********************************/
|
|
||||||
|
|
||||||
static size_t cyoBaseXXEncodeGetLength( size_t size, size_t inputBytes, size_t outputBytes )
|
|
||||||
{
|
|
||||||
return (((size + inputBytes - 1) / inputBytes) * outputBytes) + 1; /*plus terminator*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************** Base16 Encoding ******************************/
|
|
||||||
|
|
||||||
static const size_t BASE16_INPUT = 1;
|
|
||||||
static const size_t BASE16_OUTPUT = 2;
|
|
||||||
static const char* const BASE16_TABLE = "0123456789ABCDEF";
|
|
||||||
|
|
||||||
size_t cyoBase16EncodeGetLength( size_t size )
|
|
||||||
{
|
|
||||||
return cyoBaseXXEncodeGetLength( size, BASE16_INPUT, BASE16_OUTPUT );
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t cyoBase16Encode( char* dest, const void* src, size_t size )
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* output 2 bytes for every 1 input:
|
|
||||||
*
|
|
||||||
* inputs: 1
|
|
||||||
* outputs: 1 = ----1111 = 1111----
|
|
||||||
* 2 = ----2222 = ----2222
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (dest && src)
|
|
||||||
{
|
|
||||||
unsigned char* pSrc = (unsigned char*)src;
|
|
||||||
size_t dwSrcSize = size;
|
|
||||||
size_t dwDestSize = 0;
|
|
||||||
unsigned char ch;
|
|
||||||
|
|
||||||
while (dwSrcSize >= 1)
|
|
||||||
{
|
|
||||||
/* 1 input */
|
|
||||||
ch = *pSrc++;
|
|
||||||
dwSrcSize -= BASE16_INPUT;
|
|
||||||
|
|
||||||
/* 2 outputs */
|
|
||||||
*dest++ = BASE16_TABLE[ (ch & 0xf0) >> 4 ];
|
|
||||||
*dest++ = BASE16_TABLE[ (ch & 0x0f) ];
|
|
||||||
dwDestSize += BASE16_OUTPUT;
|
|
||||||
}
|
|
||||||
*dest++ = '\x0'; /*append terminator*/
|
|
||||||
|
|
||||||
return dwDestSize;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 0; /*ERROR - null pointer*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************** Base32 Encoding ******************************/
|
|
||||||
|
|
||||||
static const size_t BASE32_INPUT = 5;
|
|
||||||
static const size_t BASE32_OUTPUT = 8;
|
|
||||||
static const char* const BASE32_TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=";
|
|
||||||
|
|
||||||
size_t cyoBase32EncodeGetLength( size_t size )
|
|
||||||
{
|
|
||||||
return cyoBaseXXEncodeGetLength( size, BASE32_INPUT, BASE32_OUTPUT );
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t cyoBase32Encode( char* dest, const void* src, size_t size )
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* output 8 bytes for every 5 input:
|
|
||||||
*
|
|
||||||
* inputs: 1 2 3 4 5
|
|
||||||
* outputs: 1 = ---11111 = 11111---
|
|
||||||
* 2 = ---222XX = -----222 XX------
|
|
||||||
* 3 = ---33333 = --33333-
|
|
||||||
* 4 = ---4XXXX = -------4 XXXX----
|
|
||||||
* 5 = ---5555X = ----5555 X-------
|
|
||||||
* 6 = ---66666 = -66666--
|
|
||||||
* 7 = ---77XXX = ------77 XXX-----
|
|
||||||
* 8 = ---88888 = ---88888
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (dest && src)
|
|
||||||
{
|
|
||||||
unsigned char* pSrc = (unsigned char*)src;
|
|
||||||
size_t dwSrcSize = size;
|
|
||||||
size_t dwDestSize = 0;
|
|
||||||
size_t dwBlockSize;
|
|
||||||
unsigned char n1, n2, n3, n4, n5, n6, n7, n8;
|
|
||||||
|
|
||||||
while (dwSrcSize >= 1)
|
|
||||||
{
|
|
||||||
/* Encode inputs */
|
|
||||||
dwBlockSize = (dwSrcSize < BASE32_INPUT ? dwSrcSize : BASE32_INPUT);
|
|
||||||
n1 = n2 = n3 = n4 = n5 = n6 = n7 = n8 = 0;
|
|
||||||
switch (dwBlockSize)
|
|
||||||
{
|
|
||||||
case 5:
|
|
||||||
n8 = (pSrc[ 4 ] & 0x1f);
|
|
||||||
n7 = ((pSrc[ 4 ] & 0xe0) >> 5);
|
|
||||||
case 4:
|
|
||||||
n7 |= ((pSrc[ 3 ] & 0x03) << 3);
|
|
||||||
n6 = ((pSrc[ 3 ] & 0x7c) >> 2);
|
|
||||||
n5 = ((pSrc[ 3 ] & 0x80) >> 7);
|
|
||||||
case 3:
|
|
||||||
n5 |= ((pSrc[ 2 ] & 0x0f) << 1);
|
|
||||||
n4 = ((pSrc[ 2 ] & 0xf0) >> 4);
|
|
||||||
case 2:
|
|
||||||
n4 |= ((pSrc[ 1 ] & 0x01) << 4);
|
|
||||||
n3 = ((pSrc[ 1 ] & 0x3e) >> 1);
|
|
||||||
n2 = ((pSrc[ 1 ] & 0xc0) >> 6);
|
|
||||||
case 1:
|
|
||||||
n2 |= ((pSrc[ 0 ] & 0x07) << 2);
|
|
||||||
n1 = ((pSrc[ 0 ] & 0xf8) >> 3);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
assert( 0 );
|
|
||||||
}
|
|
||||||
pSrc += dwBlockSize;
|
|
||||||
dwSrcSize -= dwBlockSize;
|
|
||||||
|
|
||||||
/* Validate */
|
|
||||||
assert( n1 <= 31 );
|
|
||||||
assert( n2 <= 31 );
|
|
||||||
assert( n3 <= 31 );
|
|
||||||
assert( n4 <= 31 );
|
|
||||||
assert( n5 <= 31 );
|
|
||||||
assert( n6 <= 31 );
|
|
||||||
assert( n7 <= 31 );
|
|
||||||
assert( n8 <= 31 );
|
|
||||||
|
|
||||||
/* Padding */
|
|
||||||
switch (dwBlockSize)
|
|
||||||
{
|
|
||||||
case 1: n3 = n4 = 32;
|
|
||||||
case 2: n5 = 32;
|
|
||||||
case 3: n6 = n7 = 32;
|
|
||||||
case 4: n8 = 32;
|
|
||||||
case 5:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
assert( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 8 outputs */
|
|
||||||
*dest++ = BASE32_TABLE[ n1 ];
|
|
||||||
*dest++ = BASE32_TABLE[ n2 ];
|
|
||||||
*dest++ = BASE32_TABLE[ n3 ];
|
|
||||||
*dest++ = BASE32_TABLE[ n4 ];
|
|
||||||
*dest++ = BASE32_TABLE[ n5 ];
|
|
||||||
*dest++ = BASE32_TABLE[ n6 ];
|
|
||||||
*dest++ = BASE32_TABLE[ n7 ];
|
|
||||||
*dest++ = BASE32_TABLE[ n8 ];
|
|
||||||
dwDestSize += BASE32_OUTPUT;
|
|
||||||
}
|
|
||||||
*dest++ = '\x0'; /*append terminator*/
|
|
||||||
|
|
||||||
return dwDestSize;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 0; /*ERROR - null pointer*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************** Base64 Encoding ******************************/
|
|
||||||
|
|
||||||
static const size_t BASE64_INPUT = 3;
|
|
||||||
static const size_t BASE64_OUTPUT = 4;
|
|
||||||
static const char* const BASE64_TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
||||||
|
|
||||||
size_t cyoBase64EncodeGetLength( size_t size )
|
|
||||||
{
|
|
||||||
return cyoBaseXXEncodeGetLength( size, BASE64_INPUT, BASE64_OUTPUT );
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t cyoBase64Encode( char* dest, const void* src, size_t size )
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* output 4 bytes for every 3 input:
|
|
||||||
*
|
|
||||||
* inputs: 1 2 3
|
|
||||||
* outputs: 1 = --111111 = 111111--
|
|
||||||
* 2 = --22XXXX = ------22 XXXX----
|
|
||||||
* 3 = --3333XX = ----3333 XX------
|
|
||||||
* 4 = --444444 = --444444
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (dest && src)
|
|
||||||
{
|
|
||||||
unsigned char* pSrc = (unsigned char*)src;
|
|
||||||
size_t dwSrcSize = size;
|
|
||||||
size_t dwDestSize = 0;
|
|
||||||
size_t dwBlockSize = 0;
|
|
||||||
unsigned char n1, n2, n3, n4;
|
|
||||||
|
|
||||||
while (dwSrcSize >= 1)
|
|
||||||
{
|
|
||||||
/* Encode inputs */
|
|
||||||
dwBlockSize = (dwSrcSize < BASE64_INPUT ? dwSrcSize : BASE64_INPUT);
|
|
||||||
n1 = n2 = n3 = n4 = 0;
|
|
||||||
switch (dwBlockSize)
|
|
||||||
{
|
|
||||||
case 3:
|
|
||||||
n4 = (pSrc[ 2 ] & 0x3f);
|
|
||||||
n3 = ((pSrc[ 2 ] & 0xc0) >> 6);
|
|
||||||
case 2:
|
|
||||||
n3 |= ((pSrc[ 1 ] & 0x0f) << 2);
|
|
||||||
n2 = ((pSrc[ 1 ] & 0xf0) >> 4);
|
|
||||||
case 1:
|
|
||||||
n2 |= ((pSrc[ 0 ] & 0x03) << 4);
|
|
||||||
n1 = ((pSrc[ 0 ] & 0xfc) >> 2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
assert( 0 );
|
|
||||||
}
|
|
||||||
pSrc += dwBlockSize;
|
|
||||||
dwSrcSize -= dwBlockSize;
|
|
||||||
|
|
||||||
/* Validate */
|
|
||||||
assert( n1 <= 63 );
|
|
||||||
assert( n2 <= 63 );
|
|
||||||
assert( n3 <= 63 );
|
|
||||||
assert( n4 <= 63 );
|
|
||||||
|
|
||||||
/* Padding */
|
|
||||||
switch (dwBlockSize)
|
|
||||||
{
|
|
||||||
case 1: n3 = 64;
|
|
||||||
case 2: n4 = 64;
|
|
||||||
case 3:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
assert( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 4 outputs */
|
|
||||||
*dest++ = BASE64_TABLE[ n1 ];
|
|
||||||
*dest++ = BASE64_TABLE[ n2 ];
|
|
||||||
*dest++ = BASE64_TABLE[ n3 ];
|
|
||||||
*dest++ = BASE64_TABLE[ n4 ];
|
|
||||||
dwDestSize += BASE64_OUTPUT;
|
|
||||||
}
|
|
||||||
*dest++ = '\x0'; /*append terminator*/
|
|
||||||
|
|
||||||
return dwDestSize;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 0; /*ERROR - null pointer*/
|
|
||||||
}
|
|
||||||
55
vendor/cyoencode-1.0.2/src/CyoEncode.h
vendored
55
vendor/cyoencode-1.0.2/src/CyoEncode.h
vendored
|
|
@ -1,55 +0,0 @@
|
||||||
/*
|
|
||||||
* CyoEncode.h - part of the CyoEncode library
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-2012, Graham Bull.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __CYOENCODE_H
|
|
||||||
#define __CYOENCODE_H
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Base16 Encoding */
|
|
||||||
size_t cyoBase16EncodeGetLength( size_t size );
|
|
||||||
size_t cyoBase16Encode( char* dest, const void* src, size_t size );
|
|
||||||
|
|
||||||
/* Base32 Encoding */
|
|
||||||
size_t cyoBase32EncodeGetLength( size_t size );
|
|
||||||
size_t cyoBase32Encode( char* dest, const void* src, size_t size );
|
|
||||||
|
|
||||||
/* Base64 Encoding */
|
|
||||||
size_t cyoBase64EncodeGetLength( size_t size );
|
|
||||||
size_t cyoBase64Encode( char* dest, const void* src, size_t size );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /*__CYOENCODE_H*/
|
|
||||||
|
|
||||||
2
vendor/cyoencode-1.0.2/src/build.sh
vendored
2
vendor/cyoencode-1.0.2/src/build.sh
vendored
|
|
@ -1,2 +0,0 @@
|
||||||
gcc test.c CyoEncode.c CyoDecode.c -o test
|
|
||||||
|
|
||||||
162
vendor/cyoencode-1.0.2/src/cyoencode-vc100.vcxproj
vendored
162
vendor/cyoencode-1.0.2/src/cyoencode-vc100.vcxproj
vendored
|
|
@ -1,162 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|x64">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectName>cyoencode-vc100</ProjectName>
|
|
||||||
<ProjectGuid>{C773C1E9-CAC6-40AF-A400-567F73AB0178}</ProjectGuid>
|
|
||||||
<RootNamespace>cyoencodevc100</RootNamespace>
|
|
||||||
<Keyword>Win32Proj</Keyword>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<ImportGroup Label="ExtensionSettings">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)\</OutDir>
|
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)\</IntDir>
|
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)\</OutDir>
|
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)\</IntDir>
|
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<MinimalRebuild>true</MinimalRebuild>
|
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
|
||||||
<PrecompiledHeader>
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level4</WarningLevel>
|
|
||||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<TargetMachine>MachineX86</TargetMachine>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
|
||||||
<PrecompiledHeader>
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level4</WarningLevel>
|
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<PrecompiledHeader>
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level4</WarningLevel>
|
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<TargetMachine>MachineX86</TargetMachine>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<PrecompiledHeader>
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level4</WarningLevel>
|
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="CyoDecode.c" />
|
|
||||||
<ClCompile Include="CyoEncode.c" />
|
|
||||||
<ClCompile Include="test.c" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="CyoDecode.h" />
|
|
||||||
<ClInclude Include="CyoEncode.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
||||||
129
vendor/cyoencode-1.0.2/src/cyoencode-vc71.vcproj
vendored
129
vendor/cyoencode-1.0.2/src/cyoencode-vc71.vcproj
vendored
|
|
@ -1,129 +0,0 @@
|
||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="7.10"
|
|
||||||
Name="cyoencode-vc71"
|
|
||||||
ProjectGUID="{E658BBCC-49D8-4B45-B374-EF43427EB66B}"
|
|
||||||
Keyword="Win32Proj">
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"/>
|
|
||||||
</Platforms>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory="Debug"
|
|
||||||
IntermediateDirectory="Debug"
|
|
||||||
ConfigurationType="1"
|
|
||||||
CharacterSet="2">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="TRUE"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="5"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
|
||||||
DebugInformationFormat="4"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile="$(OutDir)/cyoencode-vc71.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
GenerateDebugInformation="TRUE"
|
|
||||||
ProgramDatabaseFile="$(OutDir)/cyoencode-vc71.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
TargetMachine="1"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedWrapperGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory="Release"
|
|
||||||
IntermediateDirectory="Release"
|
|
||||||
ConfigurationType="1"
|
|
||||||
CharacterSet="2">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
RuntimeLibrary="4"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
|
||||||
DebugInformationFormat="3"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile="$(OutDir)/cyoencode-vc71.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
GenerateDebugInformation="TRUE"
|
|
||||||
SubSystem="1"
|
|
||||||
OptimizeReferences="2"
|
|
||||||
EnableCOMDATFolding="2"
|
|
||||||
TargetMachine="1"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedWrapperGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<File
|
|
||||||
RelativePath=".\CyoDecode.c">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\CyoDecode.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\CyoEncode.c">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\CyoEncode.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\test.c">
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
||||||
195
vendor/cyoencode-1.0.2/src/cyoencode-vc80.vcproj
vendored
195
vendor/cyoencode-1.0.2/src/cyoencode-vc80.vcproj
vendored
|
|
@ -1,195 +0,0 @@
|
||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="8.00"
|
|
||||||
Name="cyoencode-vc80"
|
|
||||||
ProjectGUID="{F0A6E47E-F480-4F4A-8730-F655144E2D7F}"
|
|
||||||
RootNamespace="cyoencodevc80"
|
|
||||||
Keyword="Win32Proj"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
CharacterSet="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="3"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="4"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
LinkIncremental="2"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
SubSystem="1"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
CharacterSet="1"
|
|
||||||
WholeProgramOptimization="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
RuntimeLibrary="2"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
LinkIncremental="1"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
SubSystem="1"
|
|
||||||
OptimizeReferences="2"
|
|
||||||
EnableCOMDATFolding="2"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<File
|
|
||||||
RelativePath=".\CyoDecode.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\CyoDecode.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\CyoEncode.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\CyoEncode.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\test.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
||||||
341
vendor/cyoencode-1.0.2/src/cyoencode-vc90.vcproj
vendored
341
vendor/cyoencode-1.0.2/src/cyoencode-vc90.vcproj
vendored
|
|
@ -1,341 +0,0 @@
|
||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="9.00"
|
|
||||||
Name="cyoencode-vc90"
|
|
||||||
ProjectGUID="{C773C1E9-CAC6-40AF-A400-567F73AB0178}"
|
|
||||||
RootNamespace="cyoencodevc90"
|
|
||||||
Keyword="Win32Proj"
|
|
||||||
TargetFrameworkVersion="196613"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
<Platform
|
|
||||||
Name="x64"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
CharacterSet="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="3"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="4"
|
|
||||||
DebugInformationFormat="4"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
LinkIncremental="2"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
SubSystem="1"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
CharacterSet="1"
|
|
||||||
WholeProgramOptimization="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
EnableIntrinsicFunctions="true"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
RuntimeLibrary="2"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="4"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
LinkIncremental="1"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
SubSystem="1"
|
|
||||||
OptimizeReferences="2"
|
|
||||||
EnableCOMDATFolding="2"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|x64"
|
|
||||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
CharacterSet="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TargetEnvironment="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="3"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="4"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
LinkIncremental="2"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
SubSystem="1"
|
|
||||||
TargetMachine="17"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|x64"
|
|
||||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
CharacterSet="1"
|
|
||||||
WholeProgramOptimization="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TargetEnvironment="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
EnableIntrinsicFunctions="true"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
RuntimeLibrary="2"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="4"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
LinkIncremental="1"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
SubSystem="1"
|
|
||||||
OptimizeReferences="2"
|
|
||||||
EnableCOMDATFolding="2"
|
|
||||||
TargetMachine="17"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<File
|
|
||||||
RelativePath=".\CyoDecode.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\CyoDecode.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\CyoEncode.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\CyoEncode.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\test.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
||||||
191
vendor/cyoencode-1.0.2/src/test.c
vendored
191
vendor/cyoencode-1.0.2/src/test.c
vendored
|
|
@ -1,191 +0,0 @@
|
||||||
/*
|
|
||||||
* test.c - part of the CyoEncode library
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-2012, Graham Bull.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "CyoEncode.h"
|
|
||||||
#include "CyoDecode.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define TEST_BASExx(base,str,expected) \
|
|
||||||
printf( "TEST_BASE%s('%s')='%s'", #base, str, expected ); \
|
|
||||||
required = cyoBase##base##EncodeGetLength( strlen( str )); \
|
|
||||||
encoded = (char*)malloc( required ); \
|
|
||||||
if (encoded == NULL) { \
|
|
||||||
printf( "\n*** ERROR: Unable to allocate buffer for encoding ***\n" ); \
|
|
||||||
goto exit; \
|
|
||||||
} \
|
|
||||||
cyoBase##base##Encode( encoded, str, strlen( str )); \
|
|
||||||
if (strcmp( encoded, expected ) != 0) { \
|
|
||||||
printf( "\n*** ERROR: Encoding failure ***\n" ); \
|
|
||||||
goto exit; \
|
|
||||||
} \
|
|
||||||
valid = cyoBase##base##Validate( encoded, strlen( encoded )); \
|
|
||||||
if (valid < 0) \
|
|
||||||
{ \
|
|
||||||
printf( "\n*** ERROR: Unable to validate encoding (error %d) ***\n", valid ); \
|
|
||||||
goto exit; \
|
|
||||||
} \
|
|
||||||
printf( " [passed]\n" ); \
|
|
||||||
free( encoded ); encoded = NULL;
|
|
||||||
|
|
||||||
#define TEST_BASE64(str,expected) TEST_BASExx(64,str,expected)
|
|
||||||
#define TEST_BASE32(str,expected) TEST_BASExx(32,str,expected)
|
|
||||||
#define TEST_BASE16(str,expected) TEST_BASExx(16,str,expected)
|
|
||||||
|
|
||||||
#define CHECK_INVALID_BASExx(base,str,res) \
|
|
||||||
printf( "CHECK_INVALID_BASE%s('%s')=%d", #base, str, res ); \
|
|
||||||
valid = cyoBase##base##Validate( str, strlen( str )); \
|
|
||||||
if (valid == 0) \
|
|
||||||
{ \
|
|
||||||
printf( "\n*** ERROR: This is a valid encoding! ***\n" ); \
|
|
||||||
goto exit; \
|
|
||||||
} \
|
|
||||||
if (valid != res) \
|
|
||||||
{ \
|
|
||||||
printf( "\n*** ERROR: Expected a different return code! (%d) ***\n", valid ); \
|
|
||||||
goto exit; \
|
|
||||||
} \
|
|
||||||
printf( " [passed]\n", #base, str ); \
|
|
||||||
|
|
||||||
#define CHECK_INVALID_BASE16(enc,res) CHECK_INVALID_BASExx(16,enc,res)
|
|
||||||
#define CHECK_INVALID_BASE32(enc,res) CHECK_INVALID_BASExx(32,enc,res)
|
|
||||||
#define CHECK_INVALID_BASE64(enc,res) CHECK_INVALID_BASExx(64,enc,res)
|
|
||||||
|
|
||||||
int main( void )
|
|
||||||
{
|
|
||||||
const char* const original = "A wise man speaks when he has something to say";
|
|
||||||
size_t required = 0;
|
|
||||||
char* encoded = NULL;
|
|
||||||
char* decoded = NULL;
|
|
||||||
int valid = 0;
|
|
||||||
int retcode = 1;
|
|
||||||
|
|
||||||
printf( "Running CyoEncode tests...\n" );
|
|
||||||
|
|
||||||
/* Encode using Base64 */
|
|
||||||
|
|
||||||
printf( "Original = '%s'\n", original );
|
|
||||||
required = cyoBase64EncodeGetLength( strlen( original ));
|
|
||||||
encoded = (char*)malloc( required );
|
|
||||||
if (encoded == NULL)
|
|
||||||
{
|
|
||||||
printf( "*** ERROR: Unable to allocate buffer for encoding ***\n" );
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
cyoBase64Encode( encoded, original, strlen( original ));
|
|
||||||
printf( "Encoded = '%s'\n", encoded );
|
|
||||||
|
|
||||||
/* Validate encoding */
|
|
||||||
|
|
||||||
valid = cyoBase64Validate( encoded, strlen( encoded ));
|
|
||||||
if (valid < 0)
|
|
||||||
{
|
|
||||||
printf( "*** ERROR: Encoding failure (error %d) ***\n", valid );
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Decode using Base64 */
|
|
||||||
|
|
||||||
required = cyoBase64DecodeGetLength( strlen( encoded ));
|
|
||||||
decoded = (char*)malloc( required );
|
|
||||||
if (decoded == NULL)
|
|
||||||
{
|
|
||||||
printf( "*** ERROR: Unable to allocate buffer for decoding ***\n" );
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
cyoBase64Decode( decoded, encoded, strlen( encoded ));
|
|
||||||
printf( "Decoded = '%s'\n", decoded );
|
|
||||||
|
|
||||||
/* Validate */
|
|
||||||
|
|
||||||
if (strcmp( original, decoded ) != 0)
|
|
||||||
{
|
|
||||||
printf( "*** ERROR: Encoding/decoding failure ***\n" );
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
free( encoded );
|
|
||||||
encoded = NULL;
|
|
||||||
free( decoded );
|
|
||||||
decoded = NULL;
|
|
||||||
|
|
||||||
/* Test vectors from RFC 4648 */
|
|
||||||
|
|
||||||
TEST_BASE16( "", "" );
|
|
||||||
TEST_BASE16( "f", "66" );
|
|
||||||
TEST_BASE16( "fo", "666F" );
|
|
||||||
TEST_BASE16( "foo", "666F6F" );
|
|
||||||
TEST_BASE16( "foob", "666F6F62" );
|
|
||||||
TEST_BASE16( "fooba", "666F6F6261" );
|
|
||||||
TEST_BASE16( "foobar", "666F6F626172" );
|
|
||||||
|
|
||||||
TEST_BASE32( "", "" );
|
|
||||||
TEST_BASE32( "f", "MY======" );
|
|
||||||
TEST_BASE32( "fo", "MZXQ====" );
|
|
||||||
TEST_BASE32( "foo", "MZXW6===" );
|
|
||||||
TEST_BASE32( "foob", "MZXW6YQ=" );
|
|
||||||
TEST_BASE32( "fooba", "MZXW6YTB" );
|
|
||||||
TEST_BASE32( "foobar", "MZXW6YTBOI======" );
|
|
||||||
|
|
||||||
TEST_BASE64( "", "" );
|
|
||||||
TEST_BASE64( "f", "Zg==" );
|
|
||||||
TEST_BASE64( "fo", "Zm8=" );
|
|
||||||
TEST_BASE64( "foo", "Zm9v" );
|
|
||||||
TEST_BASE64( "foob", "Zm9vYg==" );
|
|
||||||
TEST_BASE64( "fooba", "Zm9vYmE=" );
|
|
||||||
TEST_BASE64( "foobar", "Zm9vYmFy" );
|
|
||||||
|
|
||||||
/* Other tests */
|
|
||||||
|
|
||||||
CHECK_INVALID_BASE16( "1", -1 );
|
|
||||||
CHECK_INVALID_BASE16( "123", -1 );
|
|
||||||
CHECK_INVALID_BASE16( "1G", -2 );
|
|
||||||
|
|
||||||
CHECK_INVALID_BASE32( "A", -1 );
|
|
||||||
CHECK_INVALID_BASE32( "ABCDEFG", -1 );
|
|
||||||
CHECK_INVALID_BASE32( "ABCDEFG1", -2 );
|
|
||||||
CHECK_INVALID_BASE32( "A=======", -2 );
|
|
||||||
|
|
||||||
CHECK_INVALID_BASE64( "A", -1 );
|
|
||||||
CHECK_INVALID_BASE64( "ABCDE", -1 );
|
|
||||||
CHECK_INVALID_BASE64( "A&B=", -2 );
|
|
||||||
CHECK_INVALID_BASE64( "A===", -2 );
|
|
||||||
|
|
||||||
printf( "*** All tests passed ***\n" );
|
|
||||||
retcode = 0;
|
|
||||||
|
|
||||||
exit:
|
|
||||||
if (encoded != NULL)
|
|
||||||
free( encoded );
|
|
||||||
if (decoded != NULL)
|
|
||||||
free( decoded );
|
|
||||||
|
|
||||||
return retcode;
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue