1.des算法源代码
2.BitMapåçä¸å®ç°
3.什么是字节码文件?
des算法源代码
des.h文件:
#ifndef CRYPTOPP_DES_H
#define CRYPTOPP_DES_H
#include "cryptlib.h"
#include "misc.h"
NAMESPACE_BEGIN(CryptoPP)
class DES : public BlockTransformation
{
public:
DES(const byte *userKey, CipherDir);
void ProcessBlock(const byte *inBlock, byte * outBlock) const;
void ProcessBlock(byte * inoutBlock) const
{ DES::ProcessBlock(inoutBlock, inoutBlock);}
enum { KEYLENGTH=8, BLOCKSIZE=8};
unsigned int BlockSize() const { return BLOCKSIZE;}
protected:
static const word Spbox[8][];
SecBlock<word> k;
};
class DESEncryption : public DES
{
public:
DESEncryption(const byte * userKey)
: DES (userKey, ENCRYPTION) { }
};
class DESDecryption : public DES
{
public:
DESDecryption(const byte * userKey)
: DES (userKey, DECRYPTION) { }
};
class DES_EDE_Encryption : public BlockTransformation
{
public:
DES_EDE_Encryption(const byte * userKey)
: e(userKey, ENCRYPTION), d(userKey + DES::KEYLENGTH, DECRYPTION) { }
void ProcessBlock(const byte *inBlock, byte * outBlock) const;
void ProcessBlock(byte * inoutBlock) const;
enum { KEYLENGTH=, BLOCKSIZE=8};
unsigned int BlockSize() const { return BLOCKSIZE;}
private:
DES e, d;
};
class DES_EDE_Decryption : public BlockTransformation
{
public:
DES_EDE_Decryption(const byte * userKey)
: d(userKey, DECRYPTION), e(userKey + DES::KEYLENGTH, ENCRYPTION) { }
void ProcessBlock(const byte *inBlock, byte * outBlock) const;
void ProcessBlock(byte * inoutBlock) const;
enum { KEYLENGTH=, BLOCKSIZE=8};
unsigned int BlockSize() const { return BLOCKSIZE;}
private:
DES d, e;
};
class TripleDES_Encryption : public BlockTransformation
{
public:
TripleDES_Encryption(const byte * userKey)
: e1(userKey, ENCRYPTION), d(userKey + DES::KEYLENGTH, DECRYPTION),
e2(userKey + 2*DES::KEYLENGTH, ENCRYPTION) { }
void ProcessBlock(const byte *inBlock, byte * outBlock) const;
void ProcessBlock(byte * inoutBlock) const;
enum { KEYLENGTH=, BLOCKSIZE=8};
unsigned int BlockSize() const { return BLOCKSIZE;}
private:
DES e1, d, e2;
};
class TripleDES_Decryption : public BlockTransformation
{
public:
TripleDES_Decryption(const byte * userKey)
: d1(userKey + 2*DES::KEYLENGTH, DECRYPTION), e(userKey + DES::KEYLENGTH, ENCRYPTION),
d2(userKey, DECRYPTION) { }
void ProcessBlock(const byte *inBlock, byte * outBlock) const;
void ProcessBlock(byte * inoutBlock) const;
enum { KEYLENGTH=, BLOCKSIZE=8};
unsigned int BlockSize() const { return BLOCKSIZE;}
private:
DES d1, e, d2;
};
NAMESPACE_END
#endif
des.cpp文件:
// des.cpp - modified by Wei Dai from:
/*
* This is a major rewrite of my old public domain DES code written
* circa , which in turn borrowed heavily from Jim Gillogly's
* public domain code. I pretty much kept my key scheduling code, but
* the actual encrypt/decrypt routines are taken from from Richard
* Outerbridge's DES code as printed in Schneier's "Applied Cryptography."
*
* This code is in the public domain. I would appreciate bug reports and
* enhancements.
*
* Phil Karn KA9Q, karn@unix.ka9q.ampr.org, August .
*/
#include "pch.h"
#include "misc.h"
#include "des.h"
NAMESPACE_BEGIN(CryptoPP)
/* Tables defined in the Data Encryption Standard documents
* Three of these tables, the initial permutation, the final
* permutation and the expansion operator, are regular enough that
* for speed, we hard-code them. They're here for reference only.
* Also, the S and P boxes are used by a separate program, gensp.c,
* to build the combined SP box, Spbox[]. They're also here just
* for reference.
*/
#ifdef notdef
/* initial permutation IP */
static byte ip[] = {
, , , , , , , 2,
, , , , , , , 4,
, , , , , , , 6,
, , , , , , , 8,
, , , , , , 9, 1,
, , , , , , , 3,
, , , , , , , 5,
, , , , , , , 7
};
/* final permutation IP^-1 */
static byte fp[] = {
, 8, , , , , , ,
, 7, , , , , , ,
, 6, , , , , , ,
, 5, , , , , , ,
, 4, , , , , , ,
, 3, , , , , , ,
, 2, , , , , , ,
, 1, , 9, , , ,
};
/* expansion operation matrix */
static byte ei[] = {
, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9,
8, 9, , , , ,
, , , , , ,
, , , , , ,
, , , , , ,
, , , , , ,
, , , , , 1
};
/* The (in)famous S-boxes */
static byte sbox[8][] = {
/* S1 */
, 4, , 1, 2, , , 8, 3, , 6, , 5, 9, 0, 7,
0, , 7, 4, , 2, , 1, , 6, , , 9, 5, 3, 8,
4, 1, , 8, , 6, 2, , , , 9, 7, 3, , 5, 0,
, , 8, 2, 4, 9, 1, 7, 5, , 3, , , 0, 6, ,
/* S2 */
, 1, 8, , 6, , 3, 4, 9, 7, 2, , , 0, 5, ,
3, , 4, 7, , 2, 8, , , 0, 1, , 6, 9, , 5,
0, , 7, , , 4, , 1, 5, 8, , 6, 9, 3, 2, ,
, 8, , 1, 3, , 4, 2, , 6, 7, , 0, 5, , 9,
/* S3 */
, 0, 9, , 6, 3, , 5, 1, , , 7, , 4, 2, 8,
, 7, 0, 9, 3, 4, 6, , 2, 8, 5, , , , , 1,
, 6, 4, 9, 8, , 3, 0, , 1, 2, , 5, , , 7,
1, , , 0, 6, 9, 8, 7, 4, , , 3, , 5, 2, ,
/* S4 */
7, , , 3, 0, 6, 9, , 1, 2, 8, 5, , , 4, ,
, 8, , 5, 6, , 0, 3, 4, 7, 2, , 1, , , 9,
, 6, 9, 0, , , 7, , , 1, 3, , 5, 2, 8, 4,
3, , 0, 6, , 1, , 8, 9, 4, 5, , , 7, 2, ,
/* S5 */
2, , 4, 1, 7, , , 6, 8, 5, 3, , , 0, , 9,
, , 2, , 4, 7, , 1, 5, 0, , , 3, 9, 8, 6,
4, 2, 1, , , , 7, 8, , 9, , 5, 6, 3, 0, ,
, 8, , 7, 1, , 2, , 6, , 0, 9, , 4, 5, 3,
/* S6 */
, 1, , , 9, 2, 6, 8, 0, , 3, 4, , 7, 5, ,
, , 4, 2, 7, , 9, 5, 6, 1, , , 0, , 3, 8,
9, , , 5, 2, 8, , 3, 7, 0, 4, , 1, , , 6,
4, 3, 2, , 9, 5, , , , , 1, 7, 6, 0, 8, ,
/* S7 */
4, , 2, , , 0, 8, , 3, , 9, 7, 5, , 6, 1,
, 0, , 7, 4, 9, 1, , , 3, 5, , 2, , 8, 6,
1, 4, , , , 3, 7, , , , 6, 8, 0, 5, 9, 2,
6, , , 8, 1, 4, , 7, 9, 5, 0, , , 2, 3, ,
/* S8 */
, 2, 8, 4, 6, , , 1, , 9, 3, , 5, 0, , 7,
1, , , 8, , 3, 7, 4, , 5, 6, , 0, , 9, 2,
7, , 4, 1, 9, , , 2, 0, 6, , , , 3, 5, 8,
2, 1, , 7, 4, , 8, , , , 9, 0, 3, 5, 6,
};
/* -bit permutation function P used on the output of the S-boxes */
static byte pi[] = {
, 7, , ,
, , , ,
1, , , ,
5, , , ,
2, 8, , ,
, , 3, 9,
, , , 6,
, , 4,
};
#endif
/* permuted choice table (key) */
static const byte pc1[] = {
, , , , , , 9,
1, , , , , , ,
, 2, , , , , ,
, , 3, , , , ,
, , , , , , ,
7, , , , , , ,
, 6, , , , , ,
, , 5, , , , 4
};
/* number left rotations of pc1 */
static const byte totrot[] = {
1,2,4,6,8,,,,,,,,,,,
};
/* permuted choice key (table) */
static const byte pc2[] = {
, , , , 1, 5,
3, , , 6, , ,
, , , 4, , 8,
, 7, , , , 2,
, , , , , ,
, , , , , ,
, , , , , ,
, , , , ,
};
/* End of DES-defined tables */
/* bit 0 is left-most in byte */
static const int bytebit[] = {
,,,,,,,
};
/* Set key (initialize key schedule array) */
DES::DES(const byte *key, CipherDir dir)
: k()
{
SecByteBlock buffer(++8);
byte *const pc1m=buffer; /* place to modify pc1 into */
byte *const pcr=pc1m+; /* place to rotate pc1 into */
byte *const ks=pcr+;
register int i,j,l;
int m;
for (j=0; j<; j++) { /* convert pc1 to bits of key */
l=pc1[j]-1; /* integer bit location */
m = l & ; /* find bit */
pc1m[j]=(key[l>>3] & /* find which key byte l is in */
bytebit[m]) /* and which bit of that byte */
1 : 0; /* and store 1-bit result */}
for (i=0; i<; i++) { /* key chunk for each iteration */
memset(ks,0,8); /* Clear key schedule */
for (j=0; j<; j++) /* rotate pc1 the right amount */
pcr[j] = pc1m[(l=j+totrot[i])<(j<? : ) ? l: l-];
/* rotate left and right halves independently */
for (j=0; j<; j++){ /* select bits individually */
/* check bit that goes to ks[j] */
if (pcr[pc2[j]-1]){
/* mask it in if it's there */
l= j % 6;
ks[j/6] |= bytebit[l] >> 2;
}
}
/* Now convert to odd/even interleaved form for use in F */
k[2*i] = ((word)ks[0] << )
| ((word)ks[2] << )
| ((word)ks[4] << 8)
| ((word)ks[6]);
k[2*i+1] = ((word)ks[1] << )
| ((word)ks[3] << )
| ((word)ks[5] << 8)
| ((word)ks[7]);
}
if (dir==DECRYPTION) // reverse key schedule order
for (i=0; i<; i+=2)
{
std::swap(k[i], k[-2-i]);
std::swap(k[i+1], k[-1-i]);
}
}
/* End of C code common to both versions */
/* C code only in portable version */
// Richard Outerbridge's initial permutation algorithm
/*
inline void IPERM(word &left, word &right)
{
word work;
work = ((left >> 4) ^ right) & 0x0f0f0f0f;
right ^= work;
left ^= work << 4;
work = ((left >> ) ^ right) & 0xffff;
right ^= work;
left ^= work << ;
work = ((right >> 2) ^ left) & 0x;
left ^= work;
right ^= (work << 2);
work = ((right >> 8) ^ left) & 0xffff;
left ^= work;
right ^= (work << 8);
right = rotl(right, 1);
work = (left ^ right) & 0xaaaaaaaa;
left ^= work;
right ^= work;
left = rotl(left, 1);
}
inline void FPERM(word &left, word &right)
{
word work;
right = rotr(right, 1);
work = (left ^ right) & 0xaaaaaaaa;
left ^= work;
right ^= work;
left = rotr(left, 1);
work = ((left >> 8) ^ right) & 0xffff;
right ^= work;
left ^= work << 8;
work = ((left >> 2) ^ right) & 0x;
right ^= work;
left ^= work << 2;
work = ((right >> ) ^ left) & 0xffff;
left ^= work;
right ^= work << ;
work = ((right >> 4) ^ left) & 0x0f0f0f0f;
left ^= work;
right ^= work << 4;
}
*/
// Wei Dai's modification to Richard Outerbridge's initial permutation
// algorithm, this one is faster if you have access to rotate instructions
// (like in MSVC)
inline void IPERM(word &left, word &right)
{
word work;
right = rotl(right, 4U);
work = (left ^ right) & 0xf0f0f0f0;
left ^= work;
right = rotr(right^work, U);
work = (left ^ right) & 0xffff;
left ^= work;
right = rotr(right^work, U);
work = (left ^ right) & 0x;
left ^= work;
right = rotr(right^work, 6U);
work = (left ^ right) & 0xffff;
left ^= work;
right = rotl(right^work, 9U);
work = (left ^ right) & 0xaaaaaaaa;
left = rotl(left^work, 1U);
right ^= work;
}
inline void FPERM(word &left, word &right)
{
word work;
right = rotr(right, 1U);
work = (left ^ right) & 0xaaaaaaaa;
right ^= work;
left = rotr(left^work, 9U);
work = (left ^ right) & 0xffff;
right ^= work;
left = rotl(left^work, 6U);
work = (left ^ right) & 0x;
right ^= work;
left = rotl(left^work, U);
work = (left ^ right) & 0xffff;
right ^= work;
left = rotl(left^work, U);
work = (left ^ right) & 0xf0f0f0f0;
right ^= work;
left = rotr(left^work, 4U);
}
// Encrypt or decrypt a block of data in ECB mode
void DES::ProcessBlock(const byte *inBlock, byte * outBlock) const
{
word l,r,work;
#ifdef IS_LITTLE_ENDIAN
l = byteReverse(*(word *)inBlock);
r = byteReverse(*(word *)(inBlock+4));
#else
l = *(word *)inBlock;
r = *(word *)(inBlock+4);
#endif
IPERM(l,r);
const word *kptr=k;
for (unsigned i=0; i<8; i++)
{
work = rotr(r, 4U) ^ kptr[4*i+0];
l ^= Spbox[6][(work) & 0x3f]
^ Spbox[4][(work >> 8) & 0x3f]
^ Spbox[2][(work >> ) & 0x3f]
^ Spbox[0][(work >> ) & 0x3f];
work = r ^ kptr[4*i+1];
l ^= Spbox[7][(work) & 0x3f]
^ Spbox[5][(work >> 8) & 0x3f]
^ Spbox[3][(work >> ) & 0x3f]
^ Spbox[1][(work >> ) & 0x3f];
work = rotr(l, 4U) ^ kptr[4*i+2];
r ^= Spbox[6][(work) & 0x3f]
^ Spbox[4][(work >> 8) & 0x3f]
^ Spbox[2][(work >> ) & 0x3f]
^ Spbox[0][(work >> ) & 0x3f];
work = l ^ kptr[4*i+3];
r ^= Spbox[7][(work) & 0x3f]
^ Spbox[5][(work >> 8) & 0x3f]
^ Spbox[3][(work >> ) & 0x3f]
^ Spbox[1][(work >> ) & 0x3f];
}
FPERM(l,r);
#ifdef IS_LITTLE_ENDIAN
*(word *)outBlock = byteReverse(r);
*(word *)(outBlock+4) = byteReverse(l);
#else
*(word *)outBlock = r;
*(word *)(outBlock+4) = l;
#endif
}
void DES_EDE_Encryption::ProcessBlock(byte *inoutBlock) const
{
e.ProcessBlock(inoutBlock);
d.ProcessBlock(inoutBlock);
e.ProcessBlock(inoutBlock);
}
void DES_EDE_Encryption::ProcessBlock(const byte *inBlock, byte *outBlock) const
{
e.ProcessBlock(inBlock, outBlock);
d.ProcessBlock(outBlock);
e.ProcessBlock(outBlock);
}
void DES_EDE_Decryption::ProcessBlock(byte *inoutBlock) const
{
d.ProcessBlock(inoutBlock);
e.ProcessBlock(inoutBlock);
d.ProcessBlock(inoutBlock);
}
void DES_EDE_Decryption::ProcessBlock(const byte *inBlock, byte *outBlock) const
{
d.ProcessBlock(inBlock, outBlock);
e.ProcessBlock(outBlock);
d.ProcessBlock(outBlock);
}
void TripleDES_Encryption::ProcessBlock(byte *inoutBlock) const
{
e1.ProcessBlock(inoutBlock);
d.ProcessBlock(inoutBlock);
e2.ProcessBlock(inoutBlock);
}
void TripleDES_Encryption::ProcessBlock(const byte *inBlock, byte *outBlock) const
{
e1.ProcessBlock(inBlock, outBlock);
d.ProcessBlock(outBlock);
e2.ProcessBlock(outBlock);
}
void TripleDES_Decryption::ProcessBlock(byte *inoutBlock) const
{
d1.ProcessBlock(inoutBlock);
e.ProcessBlock(inoutBlock);
d2.ProcessBlock(inoutBlock);
}
void TripleDES_Decryption::ProcessBlock(const byte *inBlock, byte *outBlock) const
{
d1.ProcessBlock(inBlock, outBlock);
e.ProcessBlock(outBlock);
d2.ProcessBlock(outBlock);
}
NAMESPACE_END
BitMapåçä¸å®ç°
æ¯è¾ç»å ¸çé®é¢æ¯ï¼ å¨åªè½å¤ä½¿ç¨2Gçå åä¸ï¼å¦ä½å®æ以ä¸æä½ï¼â ï¼å¯¹äº¿ä¸ªä¸éå¤çæ´æ°è¿è¡æåºã
â¡ï¼æ¾åºäº¿ä¸ªæ°åä¸éå¤çæ°åã
æ 论æ¯æåºè¿æ¯æ¾éå¤çæ°åé½éè¦å°è¿äº¿ä¸ªæ°åå å ¥å°å åä¸å¨å»è¿è¡æä½ï¼å¾ææ¾ï¼é¢ç®ç»åºç2Gå åéå¶è¯´æäºå¨è¿æ ·çåºæ¯ä¸æ¯ä¸è½å¤å°æææ°é½å å ¥å°å åä¸ç
* 4/ï¼* * ï¼ = 3.G
é£ä¹è¿æ¶åå°±éè¦ç¨å° BitMapç»æäº
bitMap使ç¨ä¸ä¸ªbit为0/1ä½ä¸ºmapçvalueæ¥æ è®°ä¸ä¸ªæ°åæ¯å¦åå¨,èmapçkeyå¼æ£æ¯è¿ä¸ªæ°åæ¬èº«ã
ç¸æ¯äºä¸è¬çæ°æ®ç»æéè¦ç¨4个byteå»åå¨æ°å¼æ¬èº«ï¼ç¸å½äºæ¯èçäº 4*8ï¼1 = åçå å空é´
bitMapä¸ä¸å®è¦ç¨bitæ°ç»,å¯ä»¥ä½¿ç¨ int,longçççåºæ¬æ°æ®ç±»åå®ç°ï¼å ä¸ºå ¶å®è´¨é½æ¯å¨bitä½ä¸åæ°æ®ï¼ç¨åªç§ç±»ååªæ¯å³å®äºæç»å®ç°åºæ¥çBitMapçå ç½®æ°ç»ä¸å个å ç´ åæ¾æ°æ®çå¤å°
ä¾å¦ï¼javaä¸çBitSet使ç¨Longæ°ç»
BitMapçå®ç°å½ç¶å°ä¸äºä½è¿ç®ï¼å æ¥æç¡®å 个常è§ä½è¿ç®ï¼è¿æ¯å®ç°BitMapçåºç¡ï¼
set(bitIndex): æ·»å æä½
1 .ç¡®å®è¯¥æ°å¤äºæ°ç»ä¸çåªä¸ªå ç´ çä½ä¸
int wordIndex = bitIndex >> 5;
å 为æç¨çæ¯int[]å®ç°ï¼æ以è¿éå³ç§» 5 ä½ï¼2^5 = ï¼
2 .ç¡®å®ç¸å¯¹äºè¯¥å ç´ ä¸çä½ç½®å移
int bitPosition = bitIndex & ((1 << 5) - 1);
è¿éç¸å½äºæ¯ bitIndex % ï¼1<<5ï¼çå模è¿ç®ï¼å 为å½å模è¿ç®çé¤æ°æ¯2ç次å¹ï¼æ以å¯ä»¥ä½¿ç¨ä»¥ä¸çä½è¿ç®æ¥è®¡ç®ï¼æåæçï¼å¯¹æ¯HashMapç容é为ä»ä¹æ»æ¯2çå¹æ¬¡æ¹çé®é¢ï¼HashMapæ±ä¸æ æ¶ä¹æ¯ä½¿ç¨ hash&(n-1)ï¼
tips: ä½è¿ç®çä¼å 级æ¯ä½äº+,-çççï¼æ以è¦å ä¸æ¬å·,é²æ¢åçä¸å¯æè¿°çé误
3 .å°è¯¥ä½ç½®1
bits[wordIndex] |= 1 << bitPosition;
ç¸å½äºæ¯å°æå®ä½ç½®å¤çbitå¼ç½®1ï¼å ¶ä»ä½ç½®ä¿æä¸åï¼ä¹å°±æ¯å°ä»¥è¿ä¸ªbitIndex为keyçä½ç½®ä¸º1
tips: è¿éæ¯åèäºç½ä¸çåä½å¤§ä½¬çæç« ,åä½ + æä½æï¼å对æ¯äºä¸BitSetçæºç ï¼
words[wordIndex] |= (1L << bitIndex);
没æåä½æä½ï¼ç´æ¥|ï¼è¿ä¸¤ä¸ªä¸æ ·åï¼çæ¡å½ç¶æ¯ä¸æ ·ç
举个æ åï¼
1 << == 1<<
1L << ==1L<<
å³å¯¹äºintålongåæ°æ®ï¼ç´æ¥å·¦ç§»å ¶ä½æ°ç¸å½äºæ¯é带äºå¯¹å ¶çå模æä½
æ»ç»ï¼ä½¿ç¨Bit-mapçææ³ï¼æ们å¯ä»¥å°åå¨ç©ºé´è¿è¡å缩ï¼èä¸å¯ä»¥å¯¹æ°åè¿è¡å¿«éæåºãå»éåæ¥è¯¢çæä½ã
Bloom Fliteræ¯Bit-mapææ³çä¸ç§æ©å±ï¼å®å¯ä»¥å¨å 许ä½é误ççåºæ¯ä¸ï¼å¤§å¤§å°è¿è¡ç©ºé´å缩ï¼æ¯ä¸ç§æ¿é误çæ¢å空é´çæ°æ®ç»æ
å½ä¸ä¸ªå ç´ å å ¥å¸éè¿æ»¤å¨ä¸çæ¶åï¼ä¼è¿è¡åªäºæä½ï¼
å½æ们éè¦å¤æä¸ä¸ªå ç´ æ¯å¦åå¨äºå¸éè¿æ»¤å¨çæ¶åï¼ä¼è¿è¡åªäºæä½ï¼
ç¶åï¼ä¸å®ä¼åºç°è¿æ ·ä¸ç§æ åµï¼ä¸åçå符串å¯è½åå¸åºæ¥çä½ç½®ç¸åï¼å¯ä»¥éå½å¢å ä½æ°ç»å¤§å°æè è°æ´æ们çåå¸å½æ°æ¥éä½æ¦çï¼,å æ¤ï¼å¸éè¿æ»¤å¨å¯è½ä¼åå¨è¯¯å¤çæ åµ
æ»ç»æ¥è¯´å°±æ¯ï¼ å¸éè¿æ»¤å¨è¯´æ个å ç´ åå¨ï¼å°æ¦çä¼è¯¯å¤ãå¸éè¿æ»¤å¨è¯´æ个å ç´ ä¸å¨ï¼é£ä¹è¿ä¸ªå ç´ ä¸å®ä¸å¨ã
Bloom Filterçåºç¨: 常ç¨äºè§£å³ç¼åç©¿éçåºæ¯ã
什么是字节码文件?
字节码文件是经过编译器预处理过的一种文件,是JAVA的执行文件存在形式,Java源程序(.java)要先编译成与平台无关的字节码文件(.class),然后字节码文件再解释成机器码运行。解释是源码大课堂通过Java虚拟机来执行的。
它本身是客服面板源码二进制文件,但是不可以被系统直接执行,而是需要虚拟机解释执行,由于被预处理过,所以比一般的解释代码要快,但是仍然会比系统直接执行的慢。
扩展资料:
在计算机中,数据只用0和1两种表现形式,成本带宽源码(这里只表示一个数据点,不是数字),一个0或者1占一个“位”,而系统中规定8个位为一个字节,std::bind 源码用来表示常用的个字母、符号、控制标记,其中用一个位来进行数据校验,国庆+源码下载其他七个位用来记录数据。
按计算机中的规定,一个英文的字符占用一个字节,(如,."':;avcAVC都占用一个字节),而一个汉字以及汉字的标点符号、字符都占用两个字节,(如,。“”:;AVCavc他们就得占用两个字节)。
另外,他们是没有办法比较的,只能将一个字符占用一个字节,N个字符占用N个字节。
K是千 M是兆 G是吉咖 T是太拉 8bit(位)=1Byte(字节) Byte(字节)=1KB KB=1MB MB=1GB GB=1TB TB=PB PB=1EB EB=1ZB ZB=1YB YB=1BB。
目前最大的计量单位是1BB (Brontobyte)= YB=^。
百度百科-字节码