# From ASCII, UTF-8 and Bit to Byte – Computer basics

## Preamble:

In this blog is the operator `^`

the exponential function almost others. So 2^3 is just 2 * 2 * 2.

## From Bits to Byte – computer basics:

Most computer systems are build to work with Byte-sized operators. A Byte is defined as eight binary digits, short Bits. This are digits with a base of 2, hence it can be either zero or one. Such a Byte is always noted with leading zeros, for example `00110101`

. This is important to see immediate the length of the data.

### Number ordering:

A number is the sum of all digit multiplied with the base to the power of the location in the number, starting with zero. So the decimal number 123 is just `1 * 10^2 + 2 * 10^1 + 3 * 10^0 = 1 * 100 + 2 * 10 + 3 * 1`

.

### Most and least significant Bit:

*The most significant Bit* (*MSB*) is the Bit with the highest order in the number, in a Byte `2^7`

. *The least significant Bit (LSB)* is always `2^0`

. In the decimal number 123 is 1 the most significant digit, so anybody usual writes the most significant Bit left and the least significant Bit right, but in the reality it is not really fix defined. When you would swap the data lines in a computer, the Byte would read in the other order, so any output is possible.

### Bytes to decimal number translation:

It is possible to construct 256 different combinations from eight digits with two possible states (two to the power of eight). There is no fix definitional how to translate a Byte to a decimal, but two major used ways:

#### Unsigned:

All Byte numbers on this homepage are *unsigned*, when not other noted, hence without negative numbers. The decimal value is just the binary value of the eight Bit. So one Byte is just a number from 0 to 255, two Bytes are together a number of 0 to 65535 (two to the power of 16) and so on.

#### Two-complement:

On the search of storing positive and negative numbers in just eight Bits on most abstract way, it figured out, a smart way would be to store negative numbers by complementing all Bits of the positive one. Complementing a Byte means negating all his Bit, hence the output of each Bit is zero when the input was one, one otherwise. When the most significant Bit is a zero, the Bits of the Byte representing the number with the base of two, if the MSB is one, the number is the negative of the complemented number. `0000 0011`

is `3`

, `1111 1100`

is `-3`

. On this way stored numbers can get added and subtracted without problems, only multiplying and dividing needs two different commands. To subtract, just add the first operand with the negotiation of the second one. Keep in mind, a Byte become never greater than eight Bit, but if you copy such a Byte in a number of multiple Bytes, the new Bits must all be set to the MSB of the old Byte. `0000 0000 1011 1010`

is not the same as `1011 1010`

! This representation, the One-complement, had just one bad side effect: You will get on calculations as results may zero and negative zero as well. The solution was to negate numbers by complementing them first, followed by adding one. When you negate zero this way, the result will be zero. The old negative zero will become -1, -1 become -2 and so on. The now free number become the most lowest negative number, what cannot get negated either. That is, when just the MSB is set. This system, called *Two-Complement*, is the most preferred way to store negative numbers in binary digits.

## Hexadecimal view:

The hexadecimal view is the major way for user-friendly representation of one or more bytes. Hexa is a Greek prefix for six and decimal means ten, so hexadecimal means 16. Since two to the power of four is 16, a hexadecimal number needs exactly four Bits for storage. We have just ten Arabic digits in usage, so we use additional the six letters A to F in the default romaji order. A is ten, B eleven and F fifteen. Upper- and lowercase doesn’t matter. To convert a Byte to his hexadecimal view, split it in two groups of four Bits and convert each of them independent to the above described number system. You may saw the MAC address of a network interface card. The contain six Bytes and is usual listed hexadecimal, each Byte separated by a colon. Hence, it looks like *01:23:45:67:89:AB*. You may find such address entries on stickers on devices with network cards (also WLAN), like your router.

0x00-0x3F | 0x40-0x7F | 0x80-0xBF | 0xC0-0xFF | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

Uns. | TC | Binary | Hexadezimal | Uns. | TC | Binary | Hexadezimal | Uns. | TC | Binary | Hexadezimal | Uns. | TC | Binary | Hexadezimal |

000 | 000 | 0000 0000 | 0x00 | 64 | 64 | 0100 0000 | 0x40 | 128 | -128 | 1000 0000 | 0x80 | 192 | -64 | 1100 0000 | 0xC0 |

001 | 001 | 0000 0001 | 0x01 | 65 | 65 | 0100 0001 | 0x41 | 129 | -127 | 1000 0001 | 0x81 | 193 | -63 | 1100 0001 | 0xC1 |

002 | 002 | 0000 0010 | 0x02 | 66 | 66 | 0100 0010 | 0x42 | 130 | -126 | 1000 0010 | 0x82 | 194 | -62 | 1100 0010 | 0xC2 |

003 | 003 | 0000 0011 | 0x03 | 67 | 67 | 0100 0011 | 0x43 | 131 | -125 | 1000 0011 | 0x83 | 195 | -61 | 1100 0011 | 0xC3 |

004 | 004 | 0000 0100 | 0x04 | 68 | 68 | 0100 0100 | 0x44 | 132 | -124 | 1000 0100 | 0x84 | 196 | -60 | 1100 0100 | 0xC4 |

005 | 005 | 0000 0101 | 0x05 | 69 | 69 | 0100 0101 | 0x45 | 133 | -123 | 1000 0101 | 0x85 | 197 | -59 | 1100 0101 | 0xC5 |

006 | 006 | 0000 0110 | 0x06 | 70 | 70 | 0100 0110 | 0x46 | 134 | -122 | 1000 0110 | 0x86 | 198 | -58 | 1100 0110 | 0xC6 |

007 | 007 | 0000 0111 | 0x07 | 71 | 71 | 0100 0111 | 0x47 | 135 | -121 | 1000 0111 | 0x87 | 199 | -57 | 1100 0111 | 0xC7 |

008 | 008 | 0000 1000 | 0x08 | 72 | 72 | 0100 1000 | 0x48 | 136 | -120 | 1000 1000 | 0x88 | 200 | -56 | 1100 1000 | 0xC8 |

009 | 009 | 0000 1001 | 0x09 | 73 | 73 | 0100 1001 | 0x49 | 137 | -119 | 1000 1001 | 0x89 | 201 | -55 | 1100 1001 | 0xC9 |

010 | 010 | 0000 1010 | 0x0A | 74 | 74 | 0100 1010 | 0x4A | 138 | -118 | 1000 1010 | 0x8A | 202 | -54 | 1100 1010 | 0xCA |

011 | 011 | 0000 1011 | 0x0B | 75 | 75 | 0100 1011 | 0x4B | 139 | -117 | 1000 1011 | 0x8B | 203 | -53 | 1100 1011 | 0xCB |

012 | 012 | 0000 1100 | 0x0C | 76 | 76 | 0100 1100 | 0x4C | 140 | -116 | 1000 1100 | 0x8C | 204 | -52 | 1100 1100 | 0xCC |

013 | 013 | 0000 1101 | 0x0D | 77 | 77 | 0100 1101 | 0x4D | 141 | -115 | 1000 1101 | 0x8D | 205 | -51 | 1100 1101 | 0xCD |

014 | 014 | 0000 1101 | 0x0E | 78 | 78 | 0100 1110 | 0x4E | 142 | -114 | 1000 1110 | 0x8E | 206 | -50 | 1100 1110 | 0xCE |

015 | 015 | 0000 1111 | 0x0F | 79 | 79 | 0100 1111 | 0x4F | 143 | -113 | 1000 1111 | 0x8F | 207 | -49 | 1100 1101 | 0xCF |

016 | 016 | 0001 0000 | 0x10 | 80 | 80 | 0101 0000 | 0x50 | 144 | -112 | 1001 0000 | 0x90 | 208 | -48 | 1101 0000 | 0xD0 |

017 | 017 | 0001 0001 | 0x11 | 81 | 81 | 0101 0001 | 0x51 | 145 | -111 | 1001 0001 | 0x91 | 209 | -47 | 1101 0001 | 0xD1 |

018 | 018 | 0001 0010 | 0x12 | 82 | 82 | 0101 0010 | 0x52 | 146 | -110 | 1001 0010 | 0x92 | 210 | -46 | 1101 0010 | 0xD2 |

019 | 019 | 0001 0011 | 0x13 | 83 | 83 | 0101 0011 | 0x53 | 147 | -109 | 1001 0011 | 0x93 | 211 | -45 | 1101 0011 | 0xD3 |

020 | 020 | 0001 0100 | 0x14 | 84 | 84 | 0101 0100 | 0x54 | 148 | -108 | 1001 0100 | 0x94 | 212 | -44 | 1101 0100 | 0xD4 |

021 | 021 | 0001 0101 | 0x15 | 85 | 85 | 0101 0101 | 0x55 | 149 | -107 | 1001 0101 | 0x95 | 213 | -43 | 1101 0101 | 0xD5 |

022 | 022 | 0001 0110 | 0x16 | 86 | 86 | 0101 0110 | 0x56 | 150 | -106 | 1001 0110 | 0x96 | 214 | -42 | 1101 0110 | 0xD6 |

023 | 023 | 0001 0111 | 0x17 | 87 | 87 | 0101 0111 | 0x57 | 151 | -105 | 1001 0111 | 0x97 | 215 | -41 | 1101 0111 | 0xD7 |

024 | 024 | 0001 1000 | 0x18 | 88 | 88 | 0101 1000 | 0x58 | 152 | -104 | 1001 1000 | 0x98 | 216 | -40 | 1101 1000 | 0xD8 |

025 | 025 | 0001 1001 | 0x19 | 89 | 89 | 0101 1001 | 0x59 | 153 | -103 | 1001 1001 | 0x99 | 217 | -39 | 1101 1001 | 0xD9 |

026 | 026 | 0001 1010 | 0x1A | 90 | 90 | 0101 1010 | 0x5A | 154 | -102 | 1001 1010 | 0x9A | 218 | -38 | 1101 1010 | 0xDA |

027 | 027 | 0001 1011 | 0x1B | 91 | 91 | 0101 1011 | 0x5B | 155 | -101 | 1001 1011 | 0x9B | 219 | -37 | 1101 1011 | 0xDB |

028 | 028 | 0001 1100 | 0x1C | 92 | 92 | 0101 1100 | 0x5C | 156 | -100 | 1001 1100 | 0x9C | 220 | -36 | 1101 1100 | 0xDC |

029 | 029 | 0001 1101 | 0x1D | 93 | 93 | 0101 1101 | 0x5D | 157 | -99 | 1001 1101 | 0x9D | 221 | -35 | 1101 1101 | 0xDD |

030 | 030 | 0001 1110 | 0x1E | 94 | 94 | 0101 1110 | 0x5E | 158 | -98 | 1001 1110 | 0x9E | 222 | -34 | 1101 1110 | 0xDE |

031 | 031 | 0001 1111 | 0x1F | 95 | 95 | 0101 1111 | 0x5F | 159 | -97 | 1001 1111 | 0x9F | 223 | -33 | 1101 1111 | 0xDF |

032 | 032 | 0010 0000 | 0x20 | 96 | 96 | 0110 0000 | 0x60 | 160 | -96 | 1010 0000 | 0xA0 | 224 | -32 | 1110 0000 | 0xE0 |

033 | 033 | 0010 0001 | 0x21 | 97 | 97 | 0110 0001 | 0x61 | 161 | -95 | 1010 0001 | 0xA1 | 225 | -31 | 1110 0001 | 0xE1 |

034 | 034 | 0010 0010 | 0x22 | 98 | 98 | 0110 0010 | 0x62 | 162 | -94 | 1010 0010 | 0xA2 | 226 | -30 | 1110 0010 | 0xE2 |

035 | 035 | 0010 0011 | 0x23 | 99 | 99 | 0110 0011 | 0x63 | 163 | -93 | 1010 0011 | 0xA3 | 227 | -29 | 1110 0011 | 0xE3 |

036 | 036 | 0010 0100 | 0x24 | 100 | 100 | 0110 0100 | 0x64 | 164 | -92 | 1010 0100 | 0xA4 | 228 | -28 | 1110 0100 | 0xE4 |

037 | 037 | 0010 0101 | 0x25 | 101 | 101 | 0110 0101 | 0x65 | 165 | -91 | 1010 0101 | 0xA5 | 229 | -27 | 1110 0101 | 0xE5 |

038 | 038 | 0010 0110 | 0x26 | 102 | 102 | 0110 0110 | 0x66 | 166 | -90 | 1010 0110 | 0xA6 | 230 | -26 | 1110 0110 | 0xE6 |

039 | 039 | 0010 0111 | 0x27 | 103 | 103 | 0110 0111 | 0x67 | 167 | -89 | 1010 0111 | 0xA7 | 231 | -25 | 1110 0111 | 0xE7 |

040 | 040 | 0010 1000 | 0x28 | 104 | 104 | 0110 1000 | 0x68 | 168 | -88 | 1010 1000 | 0xA8 | 232 | -24 | 1110 1000 | 0xE8 |

041 | 041 | 0010 1001 | 0x29 | 105 | 105 | 0110 1001 | 0x69 | 169 | -87 | 1010 1001 | 0xA9 | 233 | -23 | 1110 1001 | 0xE9 |

042 | 042 | 0010 1010 | 0x2A | 106 | 106 | 0110 1010 | 0x6A | 170 | -86 | 1010 1010 | 0xAA | 234 | -22 | 1110 1010 | 0xEA |

043 | 043 | 0010 1011 | 0x2B | 107 | 107 | 0110 1011 | 0x6B | 171 | -85 | 1010 1011 | 0xAB | 235 | -21 | 1110 1011 | 0xEB |

044 | 044 | 0010 1100 | 0x2C | 108 | 108 | 0110 1100 | 0x6C | 172 | -84 | 1010 1100 | 0xAC | 236 | -20 | 1110 1100 | 0xEC |

045 | 045 | 0010 1101 | 0x2D | 109 | 109 | 0110 1101 | 0x6D | 173 | -83 | 1010 1101 | 0xAD | 237 | -19 | 1110 1101 | 0xED |

046 | 046 | 0010 1110 | 0x2E | 110 | 110 | 0110 1110 | 0x6E | 174 | -82 | 1010 1110 | 0xAE | 238 | -18 | 1110 1110 | 0xEE |

047 | 047 | 0010 1111 | 0x2F | 111 | 111 | 0110 1111 | 0x6F | 175 | -81 | 1010 1111 | 0xAF | 239 | -17 | 1110 1111 | 0xEF |

048 | 048 | 0011 0000 | 0x30 | 112 | 112 | 0111 0000 | 0x70 | 176 | -80 | 1011 0000 | 0xB0 | 240 | -16 | 1111 0000 | 0xF0 |

049 | 049 | 0011 0001 | 0x31 | 113 | 113 | 0111 0001 | 0x71 | 177 | -79 | 1011 0001 | 0xB1 | 241 | -15 | 1111 0001 | 0xF1 |

050 | 050 | 0011 0010 | 0x32 | 114 | 114 | 0111 0010 | 0x72 | 178 | -78 | 1011 0010 | 0xB2 | 242 | -14 | 1111 0010 | 0xF2 |

051 | 051 | 0011 0011 | 0x33 | 115 | 115 | 0111 0011 | 0x73 | 179 | -77 | 1011 0011 | 0xB3 | 243 | -13 | 1111 0011 | 0xF3 |

052 | 052 | 0011 0100 | 0x34 | 116 | 116 | 0111 0100 | 0x74 | 180 | -76 | 1011 0100 | 0xB4 | 244 | -12 | 1111 0100 | 0xF4 |

053 | 053 | 0011 0101 | 0x35 | 117 | 117 | 0111 0101 | 0x75 | 181 | -75 | 1011 0101 | 0xB5 | 245 | -11 | 1111 0101 | 0xF5 |

054 | 054 | 0011 0110 | 0x36 | 118 | 118 | 0111 0110 | 0x76 | 182 | -74 | 1011 0110 | 0xB6 | 246 | -10 | 1111 0110 | 0xF6 |

055 | 055 | 0011 0111 | 0x37 | 119 | 119 | 0111 0111 | 0x77 | 183 | -73 | 1011 0111 | 0xB7 | 247 | -9 | 1111 0111 | 0xF7 |

056 | 056 | 0011 1000 | 0x38 | 120 | 120 | 0111 1000 | 0x78 | 184 | -72 | 1011 1000 | 0xB8 | 248 | -8 | 1111 1000 | 0xF8 |

057 | 057 | 0011 1001 | 0x39 | 121 | 121 | 0111 1001 | 0x79 | 185 | -71 | 1011 1001 | 0xB9 | 249 | -7 | 1111 1001 | 0xF9 |

058 | 058 | 0011 1010 | 0x3A | 122 | 122 | 0111 1010 | 0x7A | 186 | -70 | 1011 1010 | 0xBA | 250 | -6 | 1111 1010 | 0xFA |

059 | 059 | 0011 1011 | 0x3B | 123 | 123 | 0111 1011 | 0x7B | 187 | -69 | 1011 1011 | 0xBB | 251 | -5 | 1111 1011 | 0xFB |

060 | 060 | 0011 1100 | 0x3C | 124 | 124 | 0111 1100 | 0x7C | 188 | -68 | 1011 1100 | 0xBC | 252 | -4 | 1111 1100 | 0xFC |

061 | 061 | 0011 1101 | 0x3D | 125 | 125 | 0111 1101 | 0x7D | 189 | -67 | 1011 1101 | 0xBD | 253 | -3 | 1111 1101 | 0xFD |

062 | 062 | 0011 1110 | 0x3E | 126 | 126 | 0111 1110 | 0x7E | 190 | -66 | 1011 1110 | 0xBE | 254 | -2 | 1111 1110 | 0xFE |

063 | 063 | 0011 1111 | 0x3F | 127 | 127 | 0111 1111 | 0x7F | 191 | -65 | 1011 1111 | 0xBF | 255 | -1 | 1111 1111 | 0xFF |

## ASCII Codepage – from numbers to letters:

The usual basic way to store letters as Bytes is to use translation tables, called *Codepages*. The most known is ASCII, American Standard Code for Information Interchange. It has a size of seven Bits, so it contains 128 elements. The table contains uppercase characters from A to Z, lowercase characters from a to z, number characters from 0 to 9, symbols like §, $ and % and a lot of control characters. When somebody speaks about ASCII, the usual means UTF-8. As the name suggest, this Codepage is eight Bit long, hence contains the double amount of elements. The lower half of UTF-8 is the same as ASCII, so it is full compatible. Many languages contain extra letters, missed in ASCII and it is on most computer systems not possible or you need a lot extra effort to effectively store seven Bit numbers. The conclusion is to store them in eight Bits, where the most significant bit is always zero. So it has no advantages to use ASCII instead of UTF-8. That is why there are only few systems left that use ASCII.

## ASCII table:

### Wrapped in hexadecimal style:

When you view the ASCII Table below, wrapped in hexadecimal style, you will see the different groups of elements as well. It starts with 32 control characters (inclusive line feed), followed by numbers, upper case and lowercase, all separated by few symbol characters. If you search for decimal number sorting kind, look at the second table or the image including both more below.

A space is not easy to display, since it is a space filled with nothing. It has the number 0x20 (dec. 32).

x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7 | x8 | x9 | xA | xB | xC | xD | xE | xF | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

0x | NUL | SOH | STX | ETX | EOT | ENQ | ACK | BEL | BS | HT | LF | VT | CC | CR | SO | SI |

1x | DLE | DC1 | DC2 | DC3 | DC4 | NAK | SYN | ETB | CAN | EM | SUB | ESC | FS | GS | RS | US |

2x | " " | ! | " | # | $ | % | & | ' | ( | ) | * | + | , | - | . | / |

3x | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ! | ; | < | = | > | ? |

4x | @ | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O |

5x | P | Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _ |

6x | ` | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o |

7x | p | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | DEL |

### Wrapped in decimal style:

x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7 | x8 | x9 | |
---|---|---|---|---|---|---|---|---|---|---|

0x | NUL | SOH | STX | ETX | EOT | ENQ | ACK | BEL | BS | HT |

1x | LF | VT | CC | CR | SO | SI | DLE | DC1 | DC2 | DC3 |

2x | DC4 | NAK | SYN | ETB | CAN | EM | SUB | ESC | FS | GS |

3x | RS | US | " " | ! | " | # | $ | % | & | ' |

4x | ( | ) | * | + | , | - | . | / | 0 | 1 |

5x | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ! | ; |

6x | < | = | > | ? | @ | A | B | C | D | E |

7x | F | G | H | I | J | K | L | M | N | O |

8x | P | Q | R | S | T | U | V | W | X | Y |

9x | Z | [ | \ | ] | ^ | _ | ` | a | b | c |

10x | d | e | f | g | h | i | j | k | l | m |

11x | n | o | p | q | r | s | t | u | v | w |

12x | x | y | z | { | | | } | ~ | DEL |

### As image:

## UTF-8 table:

### Wrapped in hexadecimal style:

The upper part of UTF-8 is sorted in a similar pattern as ASCII. As mentioned above are 0b0xxxxxxx, hence 0x00 to 0x7f, identity to ASCII. UTF-8 chars are sometimes noted as `U-<hexadecimal number>`

. So U-DF is the character `ß`

. Sometimes are leading zeros for longer UTF versions preattended, but they are all downward compatible.

x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7 | x8 | x9 | xA | xB | xC | xD | xE | xF | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

8x | PAD | HOP | PBH | NBH | IND | NEL | SSA | ESA | HTS | HTJ | VTS | PLD | PLU | RI | SS2 | SS3 |

9x | DCS | PU1 | PU2 | STS | CCH | MW | SPA | EPA | SOS | SGC | SCI | CSI | ST | OSC | PM | APC |

Ax | NBSP | ¡ | ¢ | £ | ¤ | ¥ | ¦ | § | ¨ | © | ª | « | ¬ | SHY | ® | ¯ |

Bx | ° | ± | ² | ³ | ´ | µ | ¶ | · | ¸ | ¹ | º | » | ¼ | ½ | ¾ | ¿ |

Cx | À | Á | Â | Ã | Ä | Å | Æ | Ç | È | É | Ê | Ë | Ì | Í | Î | Ï |

Dx | Ð | Ñ | Ò | Ó | Ô | Õ | Ö | × | Ø | Ù | Ú | Û | Ü | Ý | Þ | ß |

Ex | à | á | â | ã | ä | å | æ | ç | è | é | ê | ë | ì | í | î | ï |

Fx | ð | ñ | ò | ó | ô | õ | ö | ÷ | ø | ù | ú | û | ü | ý | þ | ÿ |

### Wrapped in decimal style:

x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7 | x8 | x9 | |
---|---|---|---|---|---|---|---|---|---|---|

12x | PAD | HOP | ||||||||

13x | PBH | NBH | IND | NEL | SSA | ESA | HTS | HTJ | VTS | PLD |

14x | PLU | NBSP | SS2 | SS3 | DCS | PU1 | PU2 | STS | CCH | MW |

15x | SPA | EPA | SOS | SGC | SCI | CSI | ST | OSC | PM | APC |

16x | NBSP | ¡ | ¢ | £ | ¤ | ¥ | ¦ | § | ¨ | © |

17x | ª | « | ¬ | SHY | ® | ¯ | ° | ± | ² | ³ |

18x | ´ | µ | · | ¸ | ¹ | º | » | ¼ | ½ | ¾ |

19x | ¿ | À | Á | Â | Ã | Ä | Å | Æ | Ç | È |

20x | É | Ê | Ë | Ì | Í | Î | Ï | Ð | Ñ | Ò |

21x | Ó | Ô | Õ | Ö | × | Ø | Ù | Ú | Û | Ü |

22x | Ý | Þ | ß | à | á | â | ã | ä | å | æ |

23x | ç | è | é | ê | ë | ì | í | î | ï | ð |

24x | ñ | ò | ó | ô | õ | ö | ÷ | ø | ù | ú |

25x | û | ü | ý | þ | ÿ |

### As image:

## Stack:

A stack is a memory that have usual just two access methods, one to write (*push*) and one to read (*pop*). A pop returns and removes the most recent pushed element. Such memories are called LIFO (last-in-first-out) or FILO (first-in-last-out). So it is similar to a stack of heavy cardboard boxes or similar, where you only can add a new box above the most upper one and take the most upper one.

### Usages of stacks:

The advantage of a stack is, that it is possible to store a lot of data, where the data are managed only depending on the order of accesses. It is possible to push ten values and get them later back, as long each part pops exactly so many values they pushed. An often usage is to store a call hierarchy. When a method is called, the memory to store the local method variables, called the *stackframe*, is pushed, after leaving the method, the last stack frame is thrown away. Nearly all computer processor have instructions to push and pop data to a variable called the stack pointer inclusive increment or decrement them, but some machines have as only storage just a stack. A usual instruction pops their arguments from stack and push the result back, some just push new values to the stack. Two of the famous examples of such a stack machine are the Java Runtime Environment and *Bitcoin Script*.

## Base58:

Base is an algorithm to translate a stream of Bytes in an alphabet of displayable characters. The most know one is Base64 with 64 symbols. So it reads the incoming data in parts of six Bit. Such a representation is a way shorter than the hexadezimal view used here, but only few people are able to de- or encode them in their head. Bitcoin defines his own version Base58 for various reasons, it contains for example only symbols that don’t break the selection by double clicking on most implementations.

## Encryption:

There are two usual ways to encrypt data: *symmetric encryption* and *asymmetric encryption*. Hashing is sometimes called an encryption, but this is technical incorrect. Encryption means to change a stream of data, the plain data, by an algorithm with the usage of a second byte argument, the key. A modern encryption algorithm is called safe, if there is no realistic way known to convert parts of the encrypted data back, as long the key is unknown. An according decryption algorithm changes the encrypted data back to the plain data. This can be the same as the encryption algorthm, may do the same as the encryption algorithm in reverse order or may be completely differently. The key doesn’t need to be the same also.

### Symmetric encryption:

Symmetric encryption algorithms like Rijndael, Blowfish and Serpent are the from users most direct used ones. It is primary used to encrypt local data. You have one byte sequence as key like a passphrase, a file filled with random bytes or something else. The encryption algorithm change the plain data basing on your key, so hopefully nobody can read them. If you need your data back, the according decrypt algorithm calculate the encrypted data with the usage of your key back to their initial form.

### Asymmetric encryption:

Asymmetric encryption algorithms like RSA generating a key pair. Key pairs contains a public and private key. In the case of RSA, both keys a just two very big numbers, the exponent and the modulus, where the modulus is usual the same and 0x0100 (65536). Keys are usual just written in files, it would be laborious to transfer a key by hand. All you encrypted with one of the keys in a key pair, you can only decrypt with the other key. That allows…

**encrypted communication**: Symmetric encryption allows only encrypted communication, if the key is transferred over an absolutely safe channel, like personally. To set up a secured tunnel between Kim and Sarah, both girls generate a key pair and share their public keys. When Kim sends Sarah encrypted data, she encrypt the data first with Sarahs public key, so she can decrypt the data with her private key. In fact, there is usual a hybrid encryption used. The content of the transmitted data becomes symmetric encrypted with a secure random generated password, only this password is transferred asymmetric encrypted. That is, because symmetric encryption is fast by dimensions and easier to use.**safer logins (than password-based authentication)**: That is mostly seen per SSH, to log into a remote server. The server has a list of public keys, allowed to log in. When the user want to log in, the server generates a random password, called the challenge. That one become send encrypted by the public key send to the user, who needs to send the challenge decrypted back. That make it for attackers virtually impossible to guest the password. The private key file is usual symmetric encrypt with a password for additional protection.**signatures**: A signature is a proof of owning the private key. There are different kind of signatures, for example to encrypt the hash of data. When anybody knows my public key, and I publish a text article, I could hash the text and encrypt the hash. So it would be easy to valid the article was created or at least signed by me, by decrypt the hash with my public key and compare them with the real text hash.

It is always very important to confirm, the gotten public key is really the public key of this person. A public key written on a website would not be very trustfully, especially to prove a signature on the same page. The Pidgin-Plugin Off-the-record implements, for example, a way for an intimate answer to mark the public key as trustworthy.