INVITATION TO CYBERSECURITY 10 You may have heard the expression, “Computers are just 1s and 0s.” People say this because all the information processed by computers is binary, even the commands that computers execute. Because letters, colors, commands, etc., are all binary strings, without context, there is no way to determine how a binary string should be handled—it is all just 1s and 0s! For example, if the orangish brown color in Figure 2.2 was rendered as text using our custom 4-bit letter encoding scheme, it would read: .NS OR. Taken out of context, the results are nonsense…or worse. More on this in future chapters, but hackers have figured out ways to trick computers into confusing user-inputted data for commands causing them to execute hacker-supplied programs! Because strings of 1s and 0s are difficult for us to read, they are usually written in a base sixteen number system called hexadecimal. This is convenient because each group of four bits can be represented by one symbol. A group of four bits is called a nibble for half a byte (pun intended!). A pair of hexadecimal digits makes one byte. Hexadecimal uses sixteen symbols: the first ten are the same as the decimal system [0-9], and the last six are the first six letters of the English alphabet [a-f].2 The prefix 0x is sometimes used with hexadecimal numbers to avoid ambiguity with base ten numbers. For example, 0x10 is not equal to the number of fingers on two hands—it is sixteen in decimal (see Table 2.2). Below is the TASTE AND SEE string of bits from before rendered again in binary and then hexadecimal—still difficult to read, but much more manageable. For example, since the encoding used a nibble for each letter, each hexadecimal digit represents a single character (e.g., 1=T, 0=E, f=space, etc.): 0001001001100001000011110010010110011111011000000000 12610f259f600 A hex editor is a program that can be used to view and edit the raw bytes of a file. Rather than interpreting the bytes it renders them as hexadecimal values. Figure 2.3 shows a bitmap image file opened with an image viewer program and the same file opened with a hex editor. The hex editor shows that the first two bytes of the file are 0x42 and 0x4d, which when interpreted as ASCII, are the letters “B” and “M” for “bitmap.” This is a standard in image files so that programs know how to render the bytes. 2 The six hexadecimal letters can be written using either lowercase [a-f] or uppercase [A-F] letters—this text follows the convention of using lowercase letters.
RkJQdWJsaXNoZXIy MTM4ODY=