Home > Software engineering >  For encryption
For encryption

Time:09-22

SoQoUYXcOboCRCQuxa4tog % 3 d % 3 d

The above is what encryption

CodePudding user response:

% 3 d is es the equals sign "=" code, in this way, the "string" is:
SoQoUYXcOboCRCQuxa4tog==

A total of 24 bytes, according to the length, character features, can be judged as BASE64 encoding,

CodePudding user response:

But according to the BASE64 encoding decoding is stil going on (Q? D $.? -

CodePudding user response:

Is "someone else's data" must be a string of text!


BASE64 code can be of any data,

CodePudding user response:

This is the part of network link
Just because of the length of the judge this parameter passing things
Really don't have to be purely an encoding

CodePudding user response:

Computer memory or file content or transport it is just a one-dimensional binary byte array and its corresponding binary address;
The human brain to a computer memory or file contents or transfer the content of the one-dimensional binary byte array and its corresponding binary address some parts as an integer, number of signed/unsigned number, floating point Numbers, complex Numbers, letters, digits, Chinese/Korean/French... Character/string, assembly instructions, functions, function parameters, heap, stack, arrays, Pointers, array pointer and pointer array, the array of arrays, pointer to pointer, two-dimensional arrays, character lattice, the coordinates of character strokes, black and white binary images and grayscale images, color images, audio, video, fingerprint information, id information...

Recommended WinHex software to check the hard disk or file or original bytes of memory content,

For computer no noise, only the binary bytes; To the human brain is gibberish, GBK: 0 xb0 0 xa1, Unicode - 16 LE: 0 x4a 0 x55, Unicode - 16 BE: 0 x55 0 x4a, utf-8 8-0 x95 xE5 0 0 x8a

CodePudding user response:

BASE64 is not a kind of encryption algorithm, it is just a transfer of data format conversion agreements,

In some LAN segments of the Internet, only support code is less than 128 bytes, namely each byte of the highest is 0, this brings a problem: binary data through the network segment transmission, will lose information,

BASE64 method is through in 4 bytes 3 bytes of the original way, to reduce the size of the actual transmission byte value, namely, the 3 bytes of 24 bits, to split into each there are 6 bits 4 bytes of actual value, both high zero padding,

Case, then, use 26 letters and Numbers 0 to 9, and +/two symbols, a total of 64 characters, instead of a value of 0 to 63 bytes, that is, the actual transmission is the printable characters, in essence, it is a coding substitution, with the 64 characters are the origin of the name of BASE64,

The ASCII characters are less than 128, at the same time, does not contain will cause the control character of ambiguity, this will solve the problem of special transmission,

At the end of the BASE64 string, you can have 1 or 2==", said conversion when filling a few null bytes (byte length if the original is not a multiple of 3),

When the receiver receives a message, to reverse conversion (character conversion into bit value first, then to restructure bytes), we get the original data,

CodePudding user response:

Fyi:
 # include & lt; stdio.h> 
#include
#include

# define BASE64_VALUE_SZ 256
Int base64_value [BASE64_VALUE_SZ];
Const unsigned char alphabet [65]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +/";
The class Base64Utility {
Public:
Base64Utility ();
Int base64_encode (char * SRC, int srclen, char * DST, int tail);
Int base64_decode (char * SRC, int srclen, char * DST);
Private:
Void base_64_init (void);
};
Base64Utility: : Base64Utility () {
Base_64_init ();
}
Void Base64Utility: : base_64_init (void) {
int i;

for (i=0; i for (i=0; i <64; I++) base64_value [(int) alphabet [I]]=I;
Base64_value ['=']=0;
}
Int Base64Utility: : base64_encode (char * SRC, int srclen, char * DST, int tail) {
Int bits, char_count, len;
Lim o_char char * and * and * o_lim;
Unsigned char c;

if ( ! The SRC | |! DST) return 0;
Len=srclen;
Lim=SRC + len;
O_char=DST;
O_lim=DST + (len * 4)/3 + 1;
Char_count=0;
Bits=0;
While ((SRC & lt; Lim) & amp; & (o_char & lt; O_lim)) {
C=* (src++);
Bits +=c;
Char_count + +;
If (char_count==3) {
* (o_char + +)=alphabet [18] bits & gt; & gt;;
* (o_char + +)=alphabet [(bits & gt; & gt; 12) & amp; 0 x3f];
* (o_char + +)=alphabet [(bits & gt; & gt; 6) & amp; 0 x3f];
* (o_char + +)=alphabet [bits & amp; 0 x3f];
Bits=0;
Char_count=0;
} else {
Bits & lt; <=8;
}
}
If (char_count!=0) {
Bits & lt; <=16 - (8 * char_count);
* (o_char + +)=alphabet [18] bits & gt; & gt;;
* (o_char + +)=alphabet [(bits & gt; & gt; 12) & amp; 0 x3f];
If (char_count==1) {
If (tail) {
* (o_char + +)==' ';
* (o_char + +)==' ';
}
} else {
* (o_char + +)=alphabet [(bits & gt; & gt; 6) & amp; 0 x3f];
If (tail) {
* (o_char + +)==' ';
}
}
}
* (o_char)=0;
Return strlen (DST);
}
Int Base64Utility: : base64_decode (char * SRC, int srclen, char * DST) {
Int j;
Unsigned int k;
Int c, base_result_sz;
Long val.

if (! The SRC | |! DST) return 0;
Base_result_sz=srclen;
Val=c=0;
For (j=0; * SRC; Src++) {
K=(int) * SRC % BASE64_VALUE_SZ;
If (base64_value [k] <0) continue;
Val & lt; <=6;
Val +=base64_value [k].
If (c + + & lt; 4) continue;
DST [j++]=(char) (val & gt;> 16);
DST [j++]=(val & gt;> 8) & amp; 0 XFF.
DST [j++]=val & amp; 0 XFF.
Val=c=0;
}
The switch (c) {
Case 2://XXXXXX xx0000
DST [j++]=(val & gt;> 4) & amp; 0 XFF.
break;
Case 3://XXXXXX XXXXXX xxxx00
DST [j++]=(char) (val & gt;> 10);
DST [j++]=(val & gt;> 2) & amp; 0 XFF.
break;
}
Return j;
}
Base64Utility b64u;
# define MAXLENS 1024768
# define MAXLEND 1366360
Char bufd [MAXLEND];
Char bufs [MAXLENS];
Fs FILE * and * fd;
Int fsize;
Int main (int arg c, char * argv []) {
If (argc<4) {
USE:
Printf (" % s & lt; The -e | -e | - d> Srcfile desfile \ n ", argv [0]);
return 1; nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related