A general-purpose input/output is an uncommitted digital signal pin on an integrated circuit or electronic circuit board whose behavior—including whether it acts as input or output—is controllable by the user at run time. GPIOs are unused by default. If used, the purpose and behavior of a GPIO is defined and implemented by the designer of higher assembly-level circuitry: the circuit board designer in the case of integrated circuit GPIOs, or system integrator in the case of board-level GPIOs. Integrated circuit GPIOs are implemented in a variety of ways; some ICs provide GPIOs as a primary function whereas others include GPIOs as a convenient "accessory" to some other primary function. Examples of the former include the Intel 8255, which interfaces 24 GPIOs to a parallel bus, various GPIO "expander" ICs, which interface GPIOs to serial buses such as I²C and SMBus. An example of the latter is the Realtek ALC260 IC, which provides eight GPIOs in addition to its primary function of audio codec. Microcontroller ICs include GPIOs.
Depending on the application, a microcontroller's GPIOs may comprise its primary interface to external circuitry or they may be just one type of I/O used among several, such as analog I/O, counter/timer, serial communication. In some ICs microcontrollers, a GPIO pin may be capable of alternate functions. In such cases, it is necessary to configure the pin to operate as a GPIO in addition to configuring the GPIO's behavior; some microcontroller devices incorporate internal signal routing circuitry that allows GPIOs to be programmatically mapped to device pins. FPGAs extend this capability by allowing GPIO pin mapping and architecture to be programmatically controlled. Many circuit boards expose board-level GPIOs to external circuitry through integrated electrical connectors; each such GPIO is accessible via a dedicated connector pin. Like IC-based GPIOs, some boards include GPIOs as a convenient, auxiliary resource that augments the board's primary function, whereas in other boards the GPIOs are the central, primary function of the board.
Some boards, which are classified as multi-function I/O boards, are a combination of both. GPIOs are found on embedded controller boards such as Arduino, BeagleBone and Raspberry Pi. Board-level GPIOs are endowed with capabilities which are not found in IC-based GPIOs. For example, schmitt-trigger inputs, high-current output drivers, optical isolators, or combinations of these may be used to buffer and condition the GPIO signals and to protect board circuitry. Higher-level functions are sometimes implemented, such as input debounce, input signal edge detection, pulse-width modulation output. GPIOs are used in a diverse variety of applications, limited only by the electrical and timing specifications of the GPIO interface and the ability of software to interact with GPIOs in a sufficiently timely manner. GPIOs employ standard logic levels and cannot supply significant current to output loads; when followed by an appropriate high-current output buffer, a GPIO may be used to control high-power devices such as lights, solenoids and motors.
An input buffer, relay or optoisolator is used to translate an otherwise incompatible signal to the logic levels required by a GPIO. Integrated circuit GPIOs are used to control or monitor other circuitry on a board. Examples of this include enabling and disabling the operation of other circuitry, reading the states of on-board switches and configuration shunts, driving LED status indicators. In the latter case, a GPIO can, in many cases, supply enough output current to directly power an LED without using an intermediate buffer. Multiple GPIOs are sometimes used together as a bit-banged communication interface. For example, two GPIOs may be used to implement a serial communication bus such as I²C, four GPIOs can be used to implement an SPI bus. Taken to the extreme, this technique may be used to implement an entire parallel bus, thus allowing communication with bus-oriented ICs or circuit boards. Although GPIOs are fundamentally digital in nature, they are used to control linear processes. For example, a GPIO may be used to control light intensity, or temperature.
This is accomplished via PWM, in which the duty cycle of the GPIO output signal determines the effective magnitude of the process control signal. For example, when controlling light intensity, the light may be dimmed by reducing the GPIO duty cycle; some linear processes require a linear control voltage. GPIO interfaces vary widely. In some cases, they are simple -- a group of pins that can switch as a group to either output. In others, each pin can be set up to accept or source different logic voltages, with configurable drive strengths and pull ups/downs. Input and output voltages are typically—though not always—limited to the supply voltage of the device with the GPIOs, may be damaged by greater voltages. A GPIO pin's state may be exposed to the software developer through one of a number of different interfaces, such as a memory mapped peripheral
A stream cipher is a symmetric key cipher where plaintext digits are combined with a pseudorandom cipher digit stream. In a stream cipher, each plaintext digit is encrypted one at a time with the corresponding digit of the keystream, to give a digit of the ciphertext stream. Since encryption of each digit is dependent on the current state of the cipher, it is known as state cipher. In practice, a digit is a bit and the combining operation an exclusive-or; the pseudorandom keystream is generated serially from a random seed value using digital shift registers. The seed value serves as the cryptographic key for decrypting the ciphertext stream. Stream ciphers represent a different approach to symmetric encryption from block ciphers. Block ciphers operate on large blocks of digits with a fixed, unvarying transformation; this distinction is not always clear-cut: in some modes of operation, a block cipher primitive is used in such a way that it acts as a stream cipher. Stream ciphers execute at a higher speed than block ciphers and have lower hardware complexity.
However, stream ciphers can be susceptible to serious security problems. Stream ciphers can be viewed as approximating the action of a proven unbreakable cipher, the one-time pad, sometimes known as the Vernam cipher. A one-time pad uses a keystream of random digits; the keystream is combined with the plaintext digits one at a time to form the ciphertext. This system was proved to be secure by Claude E. Shannon in 1949. However, the keystream must be generated at random with at least the same length as the plaintext and cannot be used more than once; this makes the system cumbersome to implement in many practical applications, as a result the one-time pad has not been used, except for the most critical applications. Key generation and management are critical for those applications. A stream cipher makes use of a more convenient key such as 128 bits. Based on this key, it generates a pseudorandom keystream which can be combined with the plaintext digits in a similar fashion to the one-time pad. However, this comes at a cost.
The keystream is now pseudorandom and so is not random. The proof of security associated with the one-time pad no longer holds, it is quite possible for a stream cipher to be insecure. A stream cipher generates successive elements of the keystream based on an internal state; this state is updated in two ways: if the state changes independently of the plaintext or ciphertext messages, the cipher is classified as a synchronous stream cipher. By contrast, self-synchronising stream ciphers update their state based on previous ciphertext digits. In a synchronous stream cipher a stream of pseudo-random digits is generated independently of the plaintext and ciphertext messages, combined with the plaintext or the ciphertext. In the most common form, binary digits are used, the keystream is combined with the plaintext using the exclusive or operation; this is termed a binary additive stream cipher. In a synchronous stream cipher, the sender and receiver must be in step for decryption to be successful. If digits are added or removed from the message during transmission, synchronisation is lost.
To restore synchronisation, various offsets can be tried systematically to obtain the correct decryption. Another approach is to tag the ciphertext with markers at regular points in the output. If, however, a digit is corrupted in transmission, rather than added or lost, only a single digit in the plaintext is affected and the error does not propagate to other parts of the message; this property is useful. Moreover, because of this property, synchronous stream ciphers are susceptible to active attacks: if an attacker can change a digit in the ciphertext, he might be able to make predictable changes to the corresponding plaintext bit. Another approach uses several of the previous N ciphertext digits to compute the keystream; such schemes are known as self-synchronizing stream ciphers, asynchronous stream ciphers or ciphertext autokey. The idea of self-synchronization was patented in 1946, has the advantage that the receiver will automatically synchronise with the keystream generator after receiving N ciphertext digits, making it easier to recover if digits are dropped or added to the message stream.
Single-digit errors are limited in their effect, affecting only up to N plaintext digits. An example of a self-synchronising stream cipher is a block cipher in cipher feedback mode. Binary stream ciphers are constructed using linear-feedback shift registers because they can be implemented in hardware and can be analysed mathematically; the use of LFSRs on their own, however, is insufficient to provide good security. Various schemes have been proposed to increase the security of LFSRs; because LFSRs are inherently linear, one technique for removing the linearity is to feed the outputs of several parallel LFSRs into a non-linear Boolean function to form a combination generator. Various properties of such a combining function are critical for ensuring the security of the resultant scheme, for example, in order to avoid correlation attacks. LFSRs are stepped regularly. One approach to introducing non-linearity is to have the LFSR clocked irregularly, controlled by the output of a second LFSR; such generators include the sto
Colossus was a set of computers developed by British codebreakers in the years 1943–1945 to help in the cryptanalysis of the Lorenz cipher. Colossus used thermionic valves to perform counting operations. Colossus is thus regarded as the world's first programmable, digital computer, although it was programmed by switches and plugs and not by a stored program. Colossus was designed by research telephone engineer Tommy Flowers to solve a problem posed by mathematician Max Newman at the Government Code and Cypher School at Bletchley Park. Alan Turing's use of probability in cryptanalysis contributed to its design, it has sometimes been erroneously stated that Turing designed Colossus to aid the cryptanalysis of the Enigma. Turing's machine that helped decode; the prototype, Colossus Mark 1, was shown to be working in December 1943 and was in use at Bletchley Park by early 1944. An improved Colossus Mark 2 that used shift registers to quintuple the processing speed, first worked on 1 June 1944, just in time for the Normandy landings on D-Day.
Ten Colossi were in use by the end of the war and an eleventh was being commissioned. Bletchley Park's use of these machines allowed the Allies to obtain a vast amount of high-level military intelligence from intercepted radiotelegraphy messages between the German High Command and their army commands throughout occupied Europe; the existence of the Colossus machines was kept secret until the mid-1970s. This deprived most of those involved with Colossus of the credit for pioneering electronic digital computing during their lifetimes. A functioning rebuild of a Mark 2 Colossus was completed in 2008 by some volunteers; the Colossus computers were used to help decipher intercepted radio teleprinter messages, encrypted using an unknown device. Intelligence information revealed that the Germans called the wireless teleprinter transmission systems "Sägefisch"; this led the British to call encrypted German teleprinter traffic "Fish", the unknown machine and its intercepted messages "Tunny". Before the Germans increased the security of their operating procedures, British cryptanalysts diagnosed how the unseen machine functioned and built an imitation of it called "British Tunny".
It was deduced that the machine had twelve wheels and used a Vernam ciphering technique on message characters in the standard 5-bit ITA2 telegraph code. It did this by combining the plaintext characters with a stream of key characters using the XOR Boolean function to produce the ciphertext. In August 1941, a blunder by German operators led to the transmission of two versions of the same message with identical machine settings; these were worked on at Bletchley Park. First, John Tiltman, a talented GC&CS cryptanalyst, derived a key stream of 4000 characters. Bill Tutte, a newly arrived member of the Research Section, used this key stream to work out the logical structure of the Lorenz machine, he deduced that the twelve wheels consisted of two groups of five, which he named the χ and ψ wheels, the remaining two he called μ or "motor" wheels. The chi wheels stepped with each letter, encrypted, while the psi wheels stepped irregularly, under the control of the motor wheels. With a sufficiently random key stream, a Vernam cipher removes the natural language property of a plaintext message of having an uneven frequency distribution of the different characters, to produce a uniform distribution in the ciphertext.
The Tunny machine did this well. However, the cryptanalysts worked out that by examining the frequency distribution of the character-to-character changes in the ciphertext, instead of the plain characters, there was a departure from uniformity which provided a way into the system; this was achieved by "differencing" in which each character was XOR-ed with its successor. After Germany surrendered, allied forces captured a Tunny machine and discovered that it was the electromechanical Lorenz SZ in-line cipher machine. In order to decrypt the transmitted messages, two tasks had to be performed; the first was "wheel breaking", the discovery of the cam patterns for all the wheels. These patterns were set up on the Lorenz machine and used for a fixed period of time for a succession of different messages; each transmission, which contained more than one message, was enciphered with a different start position of the wheels. Alan Turing invented a method of wheel-breaking. Turing's technique was further developed into "Rectangling", for which Colossus could produce tables for manual analysis.
Colossi 2, 4, 6, 7 and 9 had a "gadget" to aid this process. The second task was "wheel setting", which worked out the start positions of the wheels for a particular message, could only be attempted once the cam patterns were known, it was this task for which Colossus was designed. To discover the start position of the chi wheels for a message, Colossus compared two character streams, counting statistics from the evaluation of programmable Boolean functions; the two streams were the ciphertext, read at high speed from a paper tape, the key stream, generated internally, in a simulation of the unknown German machine. After a succession of different Colossus runs to discover the chi-wheel settings, they were checked by examining the frequency distribution of the characters in processed ciphertext. Colossus prod
Trivium is a synchronous stream cipher designed to provide a flexible trade-off between speed and gate count in hardware, reasonably efficient software implementation. Trivium was submitted to the Profile II of the eSTREAM competition by its authors, Christophe De Cannière and Bart Preneel, has been selected as part of the portfolio for low area hardware ciphers by the eSTREAM project, it is not patented and has been specified as an International Standard under ISO/IEC 29192-3. It generates up to 264 bits of output from an 80-bit key and an 80-bit IV, it is the simplest eSTREAM entrant. Trivium's 288-bit internal state consists of three shift registers of different lengths. At each round, a bit is shifted into each of the three shift registers using a non-linear combination of taps from that and one other register. To initialize the cipher, the key and IV are written into two of the shift registers, with the remaining bits starting in a fixed pattern. No taps appear on the first 65 bits of each shift register, so each novel state bit is not used until at least 65 rounds after it is generated.
This is the key to Trivium's software flexibility in hardware. Trivium may be specified concisely using three recursive equations; each variable is an element of GF. Ai = ci−66 + ci−111 + ci−110 • ci−109 + ai−69 bi = ai−66 + ai−93 + ai−92 • ai−91 + bi−78 ci = bi−69 + bi−84 + bi−83 • bi−82 + ci−87The output bits r0... r264−1 are generated by ri = ci−66 + ci−111 + ai−66 + ai−93 + bi−69 + bi−84Given an 80-bit key k0... k79 and an l-bit IV v0... vl−1, Trivium is initialized as follows: = = = The large negative indices on the initial values reflect the 1152 steps that must take place before output is produced. To map a stream of bits r to a stream of bytes R, we use the little-endian mapping Ri = Σj=0... 7 2j r8i+j. A straightforward hardware implementation of Trivium would use 3488 logic gates and produce one bit per clock cycle. However, because each state bit is not used for at least 64 rounds, 64 state bits can be generated in parallel at a greater hardware cost of 5504 gates. Different tradeoffs between speed and area are possible.
The same property allows an efficient bitslice implementation in software. Was designed as an exercise in exploring how far a stream cipher can be simplified without sacrificing its security, speed or ﬂexibility. While simple designs are more to be vulnerable to simple, devastating, they inspire more confidence than complex schemes, if they survive a long period of public scrutiny despite their simplicity; as of April 2015, no cryptanalytic attacks better than brute-force attack are known, but several attacks come close. The cube attack requires 268 steps to break a variant of Trivium where the number of initialization rounds is reduced to 799. Other authors speculate that these techniques could lead to a break for 1100 initialisation rounds, or "maybe the original cipher"; this builds on an attack due to Michael Vielhaber that breaks 576 initialization rounds in only 212.3 steps. Another attack recovers the internal state of the full cipher in around 289.5 steps. Reduced variants of Trivium using the same design principles have been broken using an equation-solving technique.
These attacks improve on the well-known time-space tradeoff attack on stream ciphers, which with Trivium's 288-bit internal state would take 2144 steps, show that a variant on Trivium which made no change except to increase the key length beyond the 80 bits mandated by eSTREAM Profile 2 would not be secure. Using optimised solving strategy, it is further possible to reduce the state-recovery complexity to 2132 steps. A detailed justification of the design of Trivium is given in. ESTREAM page on Trivium eSTREAM Implementation
Characters per line
In typography and computing characters per line or terminal width refers to the maximal number of monospaced characters that may appear on a single line. It is similar to line length in typesetting; the limit of the line length in 70–80 characters may well be originated from various technical limitations of various equipment. The American teletypewriters could type only 72 CPL, while the British ones less, 70 CPL. In the era of typewriters, most designs of the typewriter carriage were limited to 80–90 CPL; the most widespread and standard paper size in the US has been imposing limitations on the line length: it is only possible to print a maximum of 85 or 102 characters without margins on the typewriter. With various margins these numbers may shrink to 55–78 CPL. In computer technology, a line of an IBM punched card could consist of only 80 characters; the widespread computer terminals such as IBM 3270 followed this limitation, their monitors could show only 80 CPL, though with some terminals this number was either reduced by half to 40 CPL, limited to 64 CPL, or optionally increased to 132 CPL.
Such line lengths have been carried over into text modes of personal computers. The "long" line of 132 CPL comes from line printers of mainframes. However, some printers or printing terminals could print as many as 216 CPL, given certain extra-wide paper sizes and/or extra-narrow font sizes. With the advent of desktop computing and publishing, technologies such as TrueType used in word processing and web browsing, a uniform CPL has been made obsolete. HTML uses dynamic word wrapping, more flexible than characters per line restriction and may produce a text block with non-rectangular shape, just like in paper typesetting. Many plain text documents still conform to 72 CPL out of tradition. Many style guides for computer programming define the maximum or desirable number of characters in a line of source code: IBM 80-column punched card format Column Line length