// a64.cpp: defines the entry point for the console application.///////
#include "stdafx.h" #include
However, if you do not enter 24, decoding is not the strcpy ((char *) out, sztemp); delete [] sztemp; printf ("encoded from Base64 to Binary% S ->% S / N", IN, OUT; STRCPY ((charr) *) In, (char *) OUT; struffpy ((char *) OUT, "ffffffffffffffffffffffffffffffffffffffffffffffff"); U16TO32 ((unsigned char *) in); Printf ("UUID32 from binary to text% S ->% s / n ", in, out); // delete [] szuuiD; // delete [] in; delete [] OUT; RETURN 0;} void U32to16 (unsigned char * c16, char * c32) {/ / char bd [] = "abcDef12123412341234123456789Abc"; // unsigned char DD [] = ""; unsigned char * DD = C16; char * bd = c32; for (int i = 0; i <32; i = 2) { Unsigned char C1 = BD [I] - (Isdigit (BD [i])? '0': 55); Unsigned char C2 = BD [i 1] - (Isdigit (BD [i 1])? '0' : 55); DD [I / 2] = (C1 << 4) (C2 & 0xF);} DD [16] = 0;} VOID U16TO32 (Char * C32, Unsigned Char * C16) {// char Ed [] = "Fffffffffffffffffffffffff"; char * ed = c32; unsigned char * DD = C16; for (int i = 0; i <16; i ) {unsigned char C3 = (DD [i] >> 4); ED [i * 2] = C3 (C3 <10? '0': 55); C3 = (DD [I] & 0xF); ED [i * 2 1] = C3 (C3 <10? '0': 55);} ED [32] = 0;
// base64 encoding away blog software static void to64frombits (unsigned char * out, const unsigned char * in, int inlen) {const char base64digits [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 /"; for (; inlen> = 3; inlen - = 3) {* OUT = Base64Digits [in [0] >> 2]; * OUT = Base64Digits [(in [0] << 4) & 0x30) | (in [1] >> 4)]; * OUT = base64digits [ ((in [1] << 2) & 0x3C) | (in [2] >> 6)]; * OUT = Base64Digits [in [2] & 0x3f]; in = 3;}} (inlen> 0) {Unsigned Char fragment; * Out = Base64Digits [in [0] >> 2]; fragment = (in [0] << 4) & 0x30; if (inlen> 1) Fragment | = in [1] >> 4; * OUT = Base64Digits [fragment]; * OUT = (INLEN <2)? '=': base64digits [(in [1] << 2) & 0x3c]; * OUT = '=';} * OUT = '/ 0 };
BYTE LMOVEBIT (INT BASE, INT MOVENUM) {BYTE Result = Base; if (Movenum == 0) Return 1; if (Movenum == 1) Return Movenum; Result = Base << (Movenum-1); Return Result;} // base64 decoded snaix@126.com byte * base64decode (char * base64code, dword base64length) {char base64_alphabet [] = {'a', 'b', 'c', 'd', 'e', 'f' , 'G', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', ' S ',' T ',' u ',' V ',' W ',' X ',' Y ',' Z ',' A ',' B ',' C ',' D ',' E ' , 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', ' R ',' s', 't', 'u', 'v', 'w', 'x', 'Y', 'Z', '0', '1', '2', '3' , '4', '5', '9', ' ', '/', '='}; char buf [4]; INT I, J; INT K; int L = 0; Byte Temp1 [4], TEMP2; BYTE * Buffer = New Byte [Base64Length * 3/4]; MEMSET (Buffer, 0, Base64Length * 3/4); DWORD BASE64A = (Base64Length / 4) -1; dword base64b = 0; int m_padnum = 0; for (; base64b