17.1.4. Exercises: QProcess and Process Control

  1. Backspace is not handled properly in this version of Qonsole. Add an event handler that does the proper thing in response to backspace.

  2. Modify the Qonsole to support multiple simultaneous terminals in separate tabs.

  3. According to NIST, the U.S. National Institute of Standards and Technology:

    A hash function takes binary data, called the message, and produces a condensed representation, called the message digest. A cryptographic hash function is a hash function that is designed to achieve certain security properties. The Federal Information Processing Standard 180-2, Secure Hash Standard, specifies algorithms for computing five cryptographic hash functions: SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512.

    For any given chunk of data, a good cryptographic hash function must reliably produce a digest that is essentially unique; that is, no other chunk of data would yield the same digest using that function. Hashing is a one-way operation; that is, it is generally not possible to reverse the process and produce the data chunk from the digest.

    Secure passwords can be handled by storing only the digest for each password. When a user logs in and enters a password, that string is immediately hashed, and the resulting digest is compared with the stored digest. If they match, the user has been validated. Otherwise, the login is not successful. The user's password is never stored and exists in memory only long enough to compute its digest.

    Qt has a class named QCryptographicHash that provides a hash function for computing the cryptographic hash of a given QByteArray. As of QT 4.7, the algorithms, SHA-1, MD4, and MD5 are supported.[101]

    1. Write a simple application that takes two command-line arguments: a string to be hashed and an argument that specifies the algorithm to be used. The application should send the resulting digest to standard output. For example:

        crhash "my big secret" md5

      would result in the output of a digest consisting of "binary" data.

    2. Using the crhash application from part (a) as a separate process, write an application that manages club member data, including userid, password, email address, street address, city, state, ZIP, and phone number. Passwords should be stored only as digests. Make sure that you serialize the club member data properly.

[ fromfile: qprocess.xml id: x-qprocess ]



[101] MD4 and MD5 are Message-Digest algorithms designed by Ron Rivest prior to the development of SHA-1, which has since been superceded by the SHA-2 family of hash functions. See http://en.wikipedia.org/wiki/MD5 for more details.