What are bits and bytes (kilobyte, megabyte, gigabyte, terabyte), as well as features of information units. Units of measurement of the volume of information Main characteristics and structure of the algorithm

The CAST-256 encryption algorithm was developed by specialists from the Canadian company Entrust Technologies. The algorithm is based on transformations of the previously widely used and well-established CAST-128 algorithm (see section 3.10), also developed by Entrust Technologies.

Main characteristics and structure of the algorithm

The CAST-256 algorithm encrypts information in 128-bit blocks and uses several fixed encryption key sizes: 128, 160, 192, 224 or 256 bits.

A 128-bit data block is divided into 4 subblocks of 32 bits each, each of which undergoes a certain transformation in each round of the algorithm and is superimposed on one of the neighboring subblocks. The developers of the algorithm classified it as a permutation-permutation network (SP-network, see sect. 1.3). However, a number of experts of the AES competition considered the CAST-256 algorithm to be a Feistel network, in each round of which only one subblock is processed, and the number of “real” rounds is 4 times more than stated in the algorithm specification.

During the operation of the algorithm, 12 rounds of transformations are performed, in the first 6 of which the transformation is performed tl (called direct round function), and in the last 6 rounds, inverse round function tl.

Transformations tl And tl shown in fig. 3.35 and 3.36 respectively. Function tl described as follows:

where / is the number of the current round.

transformation tl consists of the following operations:

The /1, /2, and /3 functions perform several elementary operations on a 32-bit subblock; they are shown, respectively, in Fig. 3.37, 3.38 and 3.39. Each of the functions takes three parameters:

□ the value of the processed sub-block (marked as “data” in the figures);

□ 32-bit round subkey km ni (called masking subkey, since the first operation of each of the functions is the imposition of this key on the processed sub-block);

□ 5-bit round subkey Krni (called shift subkey, since this key is used in the operation of cyclic shifting the result of the previous operation by a variable number of bits).

Rice. 3.35. transformationrl

Rice. 3.36. r2 transformation

Rice. 3.37. Functionfi

Rice. 3.38. Functionfl

Rice. 3.39. Function/3

Addition and subtraction are performed on 32-bit operands modulo 2 .

Functions 5|, 5 2 , 5 3 and S 4 are table lookups that replace an 8-bit input value with a 32-bit value. The tables are different, each containing 256 32-bit fixed values ​​(the tables are listed in full in Appendix 1).

Decryption is similar to encryption, but round subkeys are used in reverse order, i.e. instead of subkeys. Kx ni subkey is used Ajc/ i (1 W) (assuming that the rounds are numbered from 0 to I).

Key Expansion Procedure

The task of the key expansion function is to generate for each round 4 32-bit mask subkeys km ni and 4 5-bit shift subs Krni. That is, to form 1776 bytes of key information.

The key expansion procedure is more complicated than the data encryption itself. First, the 256-bit encryption key is divided into 8 fragments of 32 bits each. If a key of a smaller size is used, then the "extra" key fragments are considered null.

After that, the initialization of temporary variables is performed, which is described below.

Then 12 rounds of transformations are performed, in each of which the following actions are performed:

1. A function is being executed W 2 j , Where j- round number of the key expansion procedure (function wj shown in fig. 3.40).

2. Function in progress W 2 j+\ .

3. 5 least significant bits of four fragments of the result of the operation (A\ WITH, E, G) become subkeys kr 0 j, Kr X j, kr 2 j and AU 3y, respectively.

4. Remaining fragments (B', D', F\ I') become plugs Kt b ^km 2 j, Km X j And km 0 j respectively.

As you can see, in each round of the key expansion function, 8 additional variables are used. Tmnk And Trnk, which are calculated as follows:

□ the algorithm is inferior in speed to a number of algorithms - participants of the competition, including all the finalists of the competition;

□ rather high requirements for operational and non-volatile memory make it difficult to use this algorithm in smart cards;

□ Some experts have found the CAST-256 algorithm vulnerable to power consumption attacks.

NUSH("Our") is a block symmetric encryption algorithm developed by Anatoly Lebedev and Alexey Volchkov for the Russian company LAN Crypto.

NUSH has several different variants that have different block sizes (64, 128, 256 bits), different number of rounds (36, 128 or 132 rounds depending on the block size) and uses a key length of 128, 192 or 256 bits. The algorithm does not use S-boxes, but only operations such as AND, OR, XOR, modulo addition, and cyclic shifts. Before the first and after the last round, a “whitening” of the key is carried out.

This algorithm was put forward in the NESSIE project, but was not chosen because it was shown that linear cryptanalysis can be more efficient than a brute-force attack.

Other algorithms can be built on the basis of the encryption algorithm. Several of them are presented in this article.

Description of the algorithm

Encryption

Let's introduce notation. Let be the length of the encrypted plaintext block. (start key) - selected according to some schedule based on the key K. Bitwise added to the source text: After that, r-1 rounds occur, given by the following equations, in which (Round subKey) - round subkeys, # - bitwise conjunction or disjunction , is selected according to the schedule, , - known constants, >>>j - cyclic shift to the right by j bits:

The last iteration differs from the main ones only by the absence of a permutation after evaluating the expressions on the right-hand sides of the equalities:

Output: encrypted block

Decryption

According to the general formula for inverting the product of operators, a decryption procedure is also constructed.

One decryption iteration is performed:

( - length , you can perform a cyclic shift to the left by )

After that, the main decryption cycle, consisting of iterations, also not significantly different from the previous one:

Comments

Some sources believe that the encryption procedure consists of 4 times fewer rounds, consisting of 4 iterations of the above type (without initial and final addition modulo 2). So, the authors of the cipher themselves wrote their algorithm as follows:

  • We defined the function R - "iteration":
  • Described the initial transformation (addition ("+") with KS)
  • The round was said to consist of 4 iterations:

where - the corresponding constant is added to the iteration key

  • They described the final transformation (addition (“+”) with KF).

The algorithms are similar, since the “+” operation is defined by the authors separately from the main description of the encryption method. It should be noted that the schedule of "+" operations can be changed by choosing reversible binary operations on vectors of length . The non-linear operation of ordinary addition with overflow ignoring is intended to complicate linear cryptanalysis. And the XOR operation helps to avoid differential cryptanalysis. In what follows, we will consider the first description of the algorithm given in an article by Chinese mathematicians who performed a linear cryptanalysis of the algorithm.

The choice of "+" operations was made based on the results of research on parallelization of calculations on Pentium type processors. The choice of changing the order of registers a, b, c, d from round to round accelerates the appearance of diffusion and confusion. Basic operations (XOR, modulo addition, OR, AND) and their order speed up the execution of the algorithm implemented in C on most platforms, and the implementation of the algorithm in assembler is quite short.

Ease of implementation

From the above description it is clear that for the implementation of the algorithm it is necessary:

At the same time, there are no substitution tables that are present, for example, in GOST, and the round consists of 6 operations. The fact that the shift is carried out by a previously known value, which does not depend on either the plaintext or the key, greatly simplifies the implementation of the algorithm on microcircuits. The simplicity of the algorithm makes it easy to check that there is no so-called "back door" in a particular implementation.

Options

Constants and

N block length is 64 bits

36 rounds are played

i i i i
0 ac25 9 6a29 18 96da 27 d25e
1 8a93 10 6d84 19 905f 28 a926
2 243d 11 34bd 20 d631 29 1c7b
3 262e 12 a267 21 aa62 30 5f12
4 f887 13 cc15 22 4d15 31 4ecc
5 c4f2 14 04fe 23 70cb 32 3c86
6 8e36 15 b94a 24 7533 33 28db
7 9fa1 16 df24 25 45fc 34 fc01
8 7dc0 17 40ef 26 5337 35 7cb1
i i i i
0 4 9 2 18 5 27 13
1 7 10 9 19 1 28 12
2 11 11 4 20 2 29 3
3 8 12 13 21 4 30 6
4 7 13 1 22 12 31 11
5 14 14 14 23 3 32 7
6 5 15 6 24 9 33 15
7 4 16 7 25 2 34 4
8 8 17 12 26 11 35 14

Block length 128 bits

With a block length of 128 bits, 68 rounds are played. Therefore, 68 32-bit constants and 68 .

Block length 256 bits

With a block length of 256 bits, 132 rounds are played. Therefore, 132 64-bit constants and 132 .

Key Schedule

The key is represented as a concatenation of N/4-bit words. KS and KF are set arbitrarily, and all

128 bit key

Block in 64 bits

Key K is divided into 8 words

Blocks in 128 bits and 256 bits

The K key is divided into 4 and 2 words, respectively, so the round keys are repeated with a period of 4 or 2. In the latter case, there are the same among KS and KF.

192 bit key

Depending on the length of the block, the key is divided into 12, 6, and 3 n-bit parts, which determines the repetition period of the round keys.

256 bit key

Here the key is the union of 16, 8 or 4 binary words.

Operation schedule #

I # i # i # i #
0 AND 16 OR 32 OR 48 AND
1 OR 17 OR 33 OR 49 AND
2 AND 18 AND 34 AND 50 AND
3 OR 19 AND 35 OR 51 AND
4 OR 20 AND 36 OR 52 AND
5 OR 21 AND 37 AND 53 AND
6 OR 22 AND 38 OR 54 OR
7 OR 23 OR 39 AND 55 AND
8 AND 24 AND 40 OR 56 OR
9 OR 25 OR 41 AND 57 OR
10 OR 26 OR 42 AND 58 OR
11 AND 27 OR 43 OR 59 AND
12 OR 28 AND 44 OR 60 AND
13 AND 29 OR 45 AND 61 AND
14 OR 30 AND 46 AND 62 OR
15 OR 31 AND 47 AND 63 OR

For further iterations, everything is repeated:

Performance

The algorithm does not contain operations with bit complexity higher than , where is the bit length of the modulus or operands (for example, modulo product, finding the inverse (by multiplication) element or the greatest common divisor has bit complexity , and exponentiation has bit complexity ). Therefore, it is natural to expect a high speed of the algorithm. The authors provide the following data:

Safety

The main reason for the elimination of the NUSH algorithm in the NESSIE competition was the vulnerability of the algorithm to linear cryptanalysis found by Wu Wenling and Feng Dengo.

In their article “Linear cryptanalysis of the NUSH block cipher”, they use the concept of attack complexity, where it characterizes the need for memory, and - for the amount of computation.

For N=64 and N=128 bits, 3 types of attacks are proposed, and for N=256 - two. The complexity of the corresponding attacks:

Block length, bit Key length, bit
64 128
192
256
128 128
192
256
256 128
192
256

In some cases, the version with the 192-bit key is significantly more secure than the version with the longer key. You can also notice that for there are cases when the complexity of the attacks of the cipher with the smallest key length and the largest one practically coincide. In addition, increasing the key length does not affect the complexity of the attack as much as we would like.

Thus, there are attacks on the NUSH cipher that are more effective than brute force. Therefore, there is a possibility that these attacks will improve or that computing technology will reach a level sufficient to break the cipher in a reasonable time.

Cryptanalysis of the algorithm

As an example, consider the second attack on a cipher with a block length of N=64 bits. Cryptanalysis is based on the construction of dependencies between the bits of the key, the original and the ciphertext, valid with a probability different from 1/2. These relations are built on the basis of an equation that is valid with a probability of 3/4

This equation can be checked using the description of the algorithm, and taking into account that for the last (lowest) bit, the operations "+" and coincide. Indeed, we have the relation . Adding to both parts of the equation the ratio we get the required one.

Considering the first 4 rounds of decryption, it can be established that .

Using the Piling-up lemma, with probability . We got the connection between the key bits and the plain and cipher texts.

From the key schedule, it can be obtained that if the key length is 128 or 256 bits, then , if the key consists of 192 bits, then . From these data, we estimate the time complexity of the attack given by the following algorithm:

The complexity in terms of the amount of stored information is estimated as . That is how many open-ciphertext pairs a cryptanalyst should have. At the same time, the texts are by no means arbitrary. It can be seen from the above relations that they do not depend on all bits of the input and output blocks. Accordingly, among the sample of plaintext and ciphertext blocks, there must be blocks with different corresponding bits. The operation of the algorithm with a smaller number of known texts is possible, but then the “maximum” number found at the second stage is less likely to actually correspond to the real key in view of the non-exceeding of the root of the dispersion of the number of events “the equation is satisfied” over the mat. expectation of the difference in the numbers of this event and its opposite (you can consider the Bernoulli scheme, where the probability of "success" is equal to the probability of fulfilling the ratio).

Other attacks proposed in the same article differ in the analysis at the last stage of the relationships for other rounds and are of no independent interest.

Other NUSH based algorithms

Other algorithms can be built on the basis of NUSH. In particular:

  • authentication schemes

hash function

Before the hashing starts, the text is lengthened:

  • Add 1 bit to text
  • Add as many zeros to make text with a length that is a multiple of N (these two steps can be omitted if the original text length is already a multiple of N)
  • Assign an N-bit representation of the initial LEN length (in bits) of the text
  • Assign the result of a bitwise XOR between all N-bit blocks of the text obtained in the previous step

The function uses the following variables:

Initial values: , , where are constants that are added to the KR key during encryption, KS=KF=KR=0

For i = 0 to l-1

For j=0 to L/2-1 //L - the number of rounds for the corresponding type NUSH ( ) H = NUSH(V) //Encryption operation For j=15 to 4 For j=15 to 4

For j=0 to L/2-1 H = NUSH() For j=15 to 4

The hash value of length t*n (t<16) бит - первые t n-битовых слов регистра T

Message Authentication Code

Based on the hash function, a message authentication procedure can be built. It differs from the previous algorithm only in the use non-zero key.

Synchronous stream cipher "NUSH Stream"

Let SYNC be a known binary vector of length LENGTH. There are two versions of this cipher.

Option 1

Let N = LENGTH be the length of the block used in NUSH encryption (LENGTH = 64, 128, 256) Let be a vector of COUNT N-bit words that will be added to the plaintext and ciphertext for encryption and decryption, respectively.

For i =0 to COUNT −1

SYNC=(SYNC+65257)mod

Option 2

Here N=LENGTH / 2, where respectively LENGTH = 128, 256, 512. Let be a vector of length N, SYNC= - vector of length 2N T - temporary register of length N=4n, , , , - corresponding constants of the NUSH algorithm.

Calculations performed:

SYNC = SYNC ^ NUSH(SYNC)

SYNC = SYNC ^ NUSH(SYNC) T=SYNC

For i =0 to COUNT −1

T = (T + 127)mod

Asymmetric encryption

Choice of options

A specific group G is introduced with an operation defined by the authors of the algorithm based on Montgomery multiplication.

To measure length, there are such units as millimeter, centimeter, meter, kilometer. It is known that mass is measured in grams, kilograms, centners and tons. Time running is expressed in seconds, minutes, hours, days, months, years, centuries. The computer works with information and there are also appropriate units of measurement for measuring its volume.

We already know that a computer perceives all information.

Bit- this is the minimum unit of measurement of information, corresponding to one binary digit ("0" or "1").

Byte consists of eight bits. Using one byte, you can encode one character out of 256 possible (256 = 2 8). Thus, one byte is equal to one character, that is, 8 bits:

1 character = 8 bits = 1 byte.

Letter, number, punctuation mark are symbols. One letter, one symbol. One number is also one character. One punctuation mark (either a period, or a comma, or a question mark, etc.) is again one character. One space is also one character.

The study of computer literacy involves the consideration of other, larger units of information measurement.

Byte table:

1 byte = 8 bits

1 Kb (1 Kilobyte) = 2 10 bytes = 2*2*2*2*2*2*2*2*2*2 bytes =
= 1024 bytes (approximately 1 thousand bytes - 10 3 bytes)

1 MB (1 Megabyte) = 2 20 bytes = 1024 kilobytes (approximately 1 million bytes - 10 6 bytes)

1 GB (1 gigabyte) = 2 30 bytes = 1024 megabytes (approximately 1 billion bytes - 10 9 bytes)

1 TB (1 Terabyte) = 240 bytes = 1024 gigabytes (approximately 1012 bytes). Terabyte is sometimes called ton.

1 Pb (1 Petabyte) = 2 50 bytes = 1024 terabytes (approximately 10 15 bytes).

1 exabyte= 260 bytes = 1024 petabytes (approximately 1018 bytes).

1 Zettabyte= 270 bytes = 1024 exabytes (approximately 1021 bytes).

1 Yottabyte= 2 80 bytes = 1024 zettabytes (approximately 10 24 bytes).

In the table above, powers of two (2 10 , 2 20 , 2 30 , etc.) are the exact values ​​of kilobytes, megabytes, gigabytes. But the powers of the number 10 (more precisely, 10 3 , 10 6 , 10 9 , etc.) will already be approximate values, rounded down. Thus, 2 10 = 1024 bytes represents the exact value of a kilobyte, and 10 3 = 1000 bytes is the approximate value of a kilobyte.

Such an approximation (or rounding) is quite acceptable and generally accepted.

The following is a byte table with English abbreviations (in the left column):

1 Kb ~ 10 3 b = 10*10*10 b= 1000 b – kilobyte

1 Mb ~ 10 6 b = 10*10*10*10*10*10 b = 1 000 000 b - megabyte

1 Gb ~ 10 9 b - gigabyte

1 Tb ~ 10 12 b - terabyte

1 Pb ~ 10 15 b - petabyte

1 Eb ~ 10 18 b - exabyte

1 Zb ~ 10 21 b - zettabyte

1 Yb ~ 10 24 b - yottabyte

Above in the right column are the so-called "decimal prefixes", which are used not only with bytes, but also in other areas of human activity. For example, the prefix "kilo" in the word "kilobyte" means a thousand bytes, just as in the case of a kilometer it corresponds to a thousand meters, and in the example of a kilogram it is equal to a thousand grams.

To be continued…

The question arises: does the byte table have a continuation? In mathematics, there is the concept of infinity, which is denoted as an inverted eight: ∞.

It is clear that in the byte table you can continue to add zeros, or rather, powers to the number 10 in this way: 10 27 , 10 30 , 10 33 and so on ad infinitum. But why is this necessary? In principle, while terabytes and petabytes are enough. In the future, perhaps even a yottabyte will not be enough.

Finally, a couple of examples on devices that can store terabytes and gigabytes of information.

There is a convenient "terabyte" - an external hard drive that connects via USB to a computer. It can store a terabyte of information. It is especially convenient for laptops (where changing the hard drive can be problematic) and for backing up information. It is better to make backup copies of information in advance, and not after everything is gone.

Flash drives come in 1 GB, 2 GB, 4 GB, 8 GB, 16 GB, 32 GB, 64 GB and even 1 terabyte.

Since there is still no consensus on the characteristics of the supposedly upcoming NV36 and NV38 video chips, now is the time to think about some controversial issues. One of them, in particular, is the forecast regarding the memory bus capacity of future solutions from Nvidia. In the course of "clarification of rumors" about the characteristics of the NV36, the memory bus either acquired a width of 256 bits, or again lost it in favor of a more modest 128 bits. What is the meaning of this parameter for developers and what can it give the user? Our colleagues from the Beyond 3D website tried to answer this question.

So, is a 256-bit memory bus the exclusive prerogative of expensive video cards today? It is likely that even a few months ago it was possible to answer in the affirmative, but now there are fewer and fewer reasons for such confidence ...

For a long time it was believed that the layout of a board with a 256-bit memory bus could significantly increase the cost of production, and such a step could be justified only for high-yield solutions of the upper price range. Video cards Matrox Parhelia, Wildcat VP and Radeon 9700 switched to using a 256-bit bus back in 2002, which was justified for their price. But let's not forget that the famous Radeon 9500 on the "correct design" uses the same 256-bit bus, and you could buy it exactly for the price of the variant with a 128-bit bus. Is the cost factor really that important?

Currently, 128 MB of memory has become the norm for most mid-range video cards. The number of memory chips is usually eight. With a 256-bit memory bus, eight chips are also sufficient, as long as each of them has 32-bit access. In order not to provoke a noticeable gap in the performance of flagship video cards with a 256-bit bus and cheaper boards with a 128-bit bus, designers are forced to use faster memory chips (in terms of timings) on boards with a 128-bit bus, which costs more than memory for 256 -bit version, where timings do not play a big role.

The dilemma is quite simple: 8 very fast chips in a 128-bit configuration or 8 less fast chips in a 256-bit configuration. Translated into the mean language of economics, the choice is either more expensive memory chips or less expensive memory chips plus a slightly more expensive PCB design.

For the reasons discussed above, we fully recognize the option of NV36-based boards with a 256-bit memory bus as economically viable. The memory bandwidth will not be limited by bus limitations, perhaps this will slightly help increase the performance of video cards in heavy graphics modes. Given the current trend towards more complex graphics scenes, a 256-bit memory bus won't hurt even such a potentially stripped-down solution as the NV36. It remains only to wait for the end of the SIGGRAPH conference, and we will surely find out the truth...

Hello, dear readers of the blog site! In the context of the rapid development of information technology, it would not be bad to gain knowledge on some fundamental aspects, at least the main ones. This can be of great help in the future.

On the Internet, which we use thanks to computers, all information is stored or transmitted in an encoded digital format, and therefore there must be ways to measure the amount of this data, because the systematic work with them depends on it. These units are bits and bytes.

By analogy with the physical units of measurement known to us, which, when they are large, receive magnifying prefixes for ease of calculation (1000 meters = 1 kilometer, 1000 grams = 1 kilogram), the byte information unit also has its derivatives (kilobyte, megabyte, gigabyte, etc.). d.). However, in the case of a bit and a byte, there are nuances, which I will tell in more detail.

What are the units of information bit (bit) and byte (byte)

To make it clearer, you will have to state everything in more detail and start, so to speak, from the beginning. However, I will try to convey information without abstruse mathematical formulas and terms. The fact is that there are several positional number systems. I won't list them because it's not necessary.

Binary and decimal number systems

The most famous of them, which we all encounter on a daily basis, is the decimal system. In it, any number consists of digits (from 0 to 9), each of which is a digit, occupying a position strictly corresponding to it. Moreover, the bit depth increases from right to left (units, tens, hundreds, thousands, etc.).

Take for example the number 249, which can be represented as the sum of the products of digits by 10 to the power corresponding to this category:

249 = 2x10 2 + 4x10 1 + 9x10 0 = 200 + 40 + 9

Thus, the zero digit is units (10 0), the first is tens (10 1), the second is hundreds (10 2), etc. In a computer, as in other electronic devices, all information is distributed into files () and encoded accordingly in digital format, and due to ease of use, a binary number system is used, which I will dwell on separately.

In the binary system, numbers are represented using only two digits: 0 and 1. Let's try to write down the number 249 we have already considered in the binary system in order to understand its essence. To do this, we divide it by 2, getting a quotient with a remainder of 1. This one will be the least significant digit, which will be, as in the case of the decimal system, the far right.

Next, we continue the division operation and each time we also divide the integers by 2, while obtaining a remainder of 0 or 1. We write them sequentially from right to left, resulting in 249 in the binary system. The division operation should be carried out until the result is zero:

249/2 = 124 (remainder 1) 124/2 = 62 (remainder 0) 62/2 = 31 (remainder 0) 31/2 = 15 (remainder 1) 15/2 = 7 (remainder 1) 7/2 = 3 (remainder 1) 3/2 = 1 (remainder 1) 1/2 = 0 (remainder 1)

Now we write the numbers in the remainder sequentially from right to left and get our experimental number in binary:

11111001

So that there are no dark spots left, we will carry out the reverse action and try to convert the same number from binary to decimal system, at the same time checking the correctness of the above actions. To do this, we multiply, again, in order from left to right, zero or one by 2 to the degree corresponding to the category (by analogy with the decimal system):

1x2 7 + 1x2 6 + 1x2 5 + 1x2 4 + 1x2 3 + 0x2 2 + 0x2 1 + 1x2 0 = 128 + 64 + 32 + 16 + 8 + 0 + 0 + 1 = 249

As you can see, everything worked out, and we were able to convert the number written in the binary system to its notation in the decimal number system.

How many bits in a byte when using the binary system in computer science

It was not in vain that I provided a brief mathematical digression just above, since it is the binary system that serves as the basis for the measurement used in electronic devices. The basic unit of the amount of information, equal to a bit in the binary system, is just a bit.

This term comes from the English phrase b inarydig it (bit), which means a binary number. Thus, a bit can take only two possible values: 0 or 1. In computer science, this means two absolutely equal results in terms of probability (“yes” or “no”) and does not allow for another interpretation.

This is very important from the point of view of the correct operation of the system. Go ahead. The number of bits a computer can process at one time called a byte. 1 byte is equal to 8 bits and, accordingly, can take one of 2 8 (256) values, that is, from 0 to 255:


So, we now know for certain what a byte is, and what role it plays as a unit of measure in the processing of information stored and processed digitally. By the way, in the international format, a byte can be denoted in two ways - byte or B.

You can convert numbers in decimal to binary using a calculator. If you have Windows 7, then you can call this tool like this: Start - All Programs - Accessories - Calculator. From the "View" menu choose Format "Programmer" and enter the desired number (in my example it is 120):


Now turn on the radio buttons "Bin" and "1 byte", after which you get a record of this number in the binary system:


What should you pay attention to here? Firstly, there are only seven digits in the display line (bits with values ​​zero or one), although we already know that there should be eight if the byte value is from 0 to 255:

Everything is simple here. If the most significant digit (bit), located on the far left, takes on the value 0, then it is simply not recorded. Two or more zero bits are also omitted (by analogy with decimal numbers - after all, we do not prescribe 0 thousand for hundreds, for example).

The proof can be the full record of the received number, which is displayed in small print just below:

0111 1000

If you are careful, you will see what is the second. This is a way of writing in two parts, each of which consists of four bits. In computer science, there is another concept nibble or nibble(nibble). This is convenient because the nibble can be represented as a digit in the hexadecimal system, which is widely used in programming.

It takes more than 1 byte to process data - what then?

Above, we talked about the fact that a byte contains eight bits. This allows you to express 256 (two to the eighth) different values. However, in practice, this is generally far from sufficient, and in many cases it is necessary to use not one, but several bytes. As an example, let's use the Windows calculator again and convert the number 1000 to binary:


As you can see, for this we had to pinch off a couple of bits from the second byte. In practice, in computers to process enough voluminous information uses such a concept as a machine word, which can contain 16, 32, 64 bits.

With their help, you can express respectively 2 16 , 2 32 and 2 64 different values. But in this case, you cannot talk about 2, 4 or 8 bytes, these are slightly different things. This is where the legs grow from mentioning, for example, 32-, 64-bit (-bit) processors or other devices.


How many bytes are in a kilobyte, megabyte, gigabyte, terabyte

Well, now is the time to move on to the derivatives of the byte and imagine what increment prefixes are used here. After all, a byte as a unit is a very small value, and for convenience it is very useful to use analogues that would denote 1000 B, 1,000,000 B, etc. Here, too, there are nuances, which we will discuss below.

Strictly speaking, to represent quantities, it is correct to use prefixes for the binary number system, which are multiples of 2 10 (1024). These are kibibyte, mebibyte, gebibyte, etc.

1 kibibyte = 2 10 (1024) bytes 1 mebibyte = 2 10 (1024) kibibytes = 2 20 (1 048 576) bytes 1 gebibyte = 2 10 (1024) mebibytes = 2 20 (1 048 576) kibibytes = 2 30 (1 073 741 824) byte 1 tebibyte = 2 10 (1024) gebibyte = 2 20 (1 048 576) mebibyte = 2 30 (1 073 741 824) kibibyte = 2 40 (1 099 511 627 776) bytes

But these phrases did not take root in wide use. Perhaps one of the reasons was their dissonance. Therefore, users (and not only) everywhere use decimal prefixes instead of binary ones (kilobytes, megabytes, gigabytes, terabytes), which is not entirely correct, since in essence (in accordance with the rules of the decimal number system) this means the following:

1 kilobyte = 10 3 (1000) bytes 1 megabyte = 10 3 (1000) kilobytes = 10 6 (1 000 000) bytes 1 gigabyte = 10 3 (1000) megabytes = 10 6 (1 000 000) kilobytes = 10 9 (1 000 000 000) bytes 1 terabyte = 10 3 (1000) gigabytes = 10 6 (1 000 000) megabytes = 10 9 (1 000 000 000) kilobytes = 10 12 (1 000 000 000 000) bytes

But once that's the case, there's nothing you can do. It is only important to remember that in practice kilobytes (KB), megabytes (MB), gigabytes (GB), terabytes (TB) are often used precisely as derivatives of a byte as a unit of measurement of the amount of information in the binary system. And in this case, for example, the term "kilobyte" is used, meaning exactly 1024 bytes and nothing else.

However, very often manufacturers of storage devices (including hard drives, flash drives, DVDs and CDs) use decimal prefixes for their intended purpose (1 KB = 1000 bytes) when specifying the volume for storing information, while the same Windows, for example , calculates their size in binary.

This is where some discrepancy comes from, which can confuse a simple user. Let's say the documentation says disk capacity 500 GB, while Windows is showing it volume equal to 466.65 GB.

In fact, there is no discrepancy, just the size of the drive is present in different number systems (the same stump, only on the side). For inexperienced users, this is extremely inconvenient, but, as I said, you have to put up with it.

Summarizing, I note the following. Let's say you are asked the question: how many bytes are in a kilobyte? Theoretically, the correct answer is: 1 kilobyte is equal to 1000 bytes. Just keep in mind that in practice, for the most part, decimal prefixes are used as binary ones, which are a multiple of 1024, although sometimes they are used for their intended purpose and are a multiple of exactly 1000.

Here is the arithmetic, I hope you are not confused. In the publication, I mentioned kilobytes, megabytes, gigabytes and terabytes, but what next? What even larger units of quantity of information are possible? This question will be answered by a table that shows not only the ratio of units in both systems, but also their designations in international and Russian formats:

Binary system Decimal system
Name Designation Degree Name Designation Degree
Ros. Int. Ros. Int.
byte B B 2 0 byte B B 10 0
kibibyte KiB KiB 2 10 kilobyte KB KB 10 3
mebibyte MiB MiB 2 20 megabyte MB MB 10 6
gibibyte GiB GiB 2 30 gigabyte GB GB 10 9
tebibyte Tib TiB 2 40 terabyte TB TV 10 12
pebibyte P&B PiB 2 50 petabyte pb PB 10 15
exbibyte EIB EiB 2 60 exabyte Ebyte EB 10 18
zebibyte ZiB ZiB 2 70 zettabyte Zbyte ZB 10 21
yobibyte Y&B YiB 2 80 yottabyte Ibyte YB 10 24

If you want to quickly determine, for example, how many megabytes are in a gigabyte (although an experienced user, of course, can easily do without a table in this case), then look in the table for a cell corresponding to the number of bytes in a megabyte and a gigabyte, and then divide the larger value by the smaller one.

10 9 /10 6 = 1 000 000 000/1 000 000 = 1000

It turns out that there are 1000 megabytes in 1 gigabyte. Similarly, you can convert derivatives in the binary system - mebibytes to kibibytes, tebibytes to gibibytes, etc.

Convert bytes to bits, kilobytes, megabytes, gigabytes, terabytes in an online converter

The publication would be incomplete if I did not provide a tool with which you can translate byte into various derivatives. There are many different converters on the network, through which you can perform these simple operations. Here is one of them that I liked.

This converter is convenient because by entering the number of byte, you can immediately get the result in all possible dimensions (including converting bits to bytes):

From this example it follows that 3072 bytes is equal to 24576 bits, 3.0720 kilobytes or 3 kibibytes. In addition, just below are links to mini-calculators, where you can quickly make a specific conversion from one system of units to another.

Share with friends or save for yourself:

Loading...