What is a digest?
Ans: It is a one-way encryption algorithm. For example, the MD5 digest algorithm always encodes a message (which could be
a password) in 32 bytes. A digest as also called a cryptographic hash.
True or false: if a password is encrypted with MD5, the original password can be obtained
if the hacker can obtain the private key.
Ans: False. A digest is a one-way encryption algorithm. There is no private key that can decode it.
Genius Question: For Project 4, how can you take all of the photos from all followers of a
user and display them together or order of most recent to least recent.
Ans:
See the MiniTwitter Example.
This example shows how create a self referential join. A one-to-many relationship from the
employee relationship to itself creates the methods manager and subordinate.
This concept can apply to the connections in the LinkedIn network.
However, for LinkedIn, the connections are bidirectional:
belongs_to is the only method that is needed in the model.
Photo Model Code
In a standalone Ruby script, try reading an input file, converting it to uppercase, and writing back
out to disc. Do this in three ways:
Read, process, and write line at a time.
Read, process, and write one character at a time.
Read the entire file into a string, process it, and write this string.