Final Assignment

This final assignment is open-book: you may use any and all non-human resources during the test, but the only humans to whom you may turn for help or from whom you may receive help are the course’s staff, which means that

you may

  • browse and search the internet,
  • review books,
  • review the course’s own materials,
  • use CS50 IDE,
  • email the course’s staff at hls@cs50.harvard.edu with questions, but

you may not

  • receive or solicit directly or indirectly any help from anyone other than the course’s staff.

Among this final assignment’s aims is to assess your newfound comfort with the course’s material and your ability to apply the course’s lessons to familiar and unfamiliar problems. And most problems aspire to teach something new!

What to Do

  1. Open this Google Doc.
  2. Make a copy of the Google Doc in your own Google account by choosing File → Make a Copy.
  3. Answer each of the questions below in the Google Doc by filling in the blanks marked TODO. Your answers, if not code, should be no more than a few sentences in length each.

Questions

Cryptocurrency

If unfamiliar, here’s how bitcoin, a “cryptocurrency,” works, youtube.com/embed/bBC-nXj3Ng4?end=1314. Watch up through 00:21:54.

  1. What, in your own words, is a blockchain? How does bitcoin use a blockchain?

  2. What problem does a (cryptographic) hash function solve for bitcoin?

  3. In the context of hash tables, we discussed a hash function that, given a string, returns a number from 0 through 25, based on that string’s first character. Why is that hash function unsuitable as a cryptographic hash function?

Hello, Java

Consider the source code, below, for a program written in not Python but Java!

class Hello
{
    public static void main(String [] args)
    {
        System.out.println("hello, world");
    }
}

Suppose that, as the most technical person in your firm, you’ve been handed this code (even though you don’t actually know Java!) and been asked to compile and run it. Armed only with your intuition and Google, ascertain how. Hint: using CS50 IDE, first save it in a file called Hello.java.

  1. Via what single command can you compile that program?

  2. Via what single command can you run that program, once compiled?

  3. Change the program in such a way that it first prompts a user for their name and then prints “hello, so-and-so”, where so-and-so is their name.

  4. In a new file called hello.py, rewrite that same program in Python.

Benefits and Risks Associated with Relevant Technology

If unfamiliar, read up on how AI might affect the legal profession, jolt.law.harvard.edu/digest/a-primer-on-using-artificial-intelligence-in-the-legal-profession.

  1. For legal research, why might AI-based search results be better than keyword-based search results alone?

  2. Even as AI improves, what are two legal tasks at which (human) attorneys or paralegals might still be better?

Select Appeal

  1. Suppose that you’ve decided to store all past Supreme Court decisions in a SQL table, including each case’s appellant, appellee, year, volume, and first page. Via what single SQL statement could you create, using appropriate SQLite types, such a table? You’re welcome to use DB Browser to create the table manually and then copy/paste the corresponding CREATE statement here.

  2. A decision quite often cites one or more prior decisions. Propose, in English but in sufficiently technical terms that a developer would understand, how you could implement citations (i.e., associate decisions with other decisions) in a SQL database.

Net Neutrality

If unfamiliar, here’s a look at the issue of net neutrality, youtu.be/92vuuZt7wak, with a follow-up at euro.ecom.cmu.edu/program/law/08-732/Neutrality/Primer.pdf.

  1. In your own words, what is net neutrality?

  2. Technologically, how might an internet service provider (e.g., Comcast) implement prioritization of some traffic over other?

Cookies

Per developer.mozilla.org/en-US/docs/Web/HTTP/Cookies, recall that cookies are sometimes sent from web servers to browsers (and back). Per blog.chromium.org/2020/01/building-more-private-web-path-towards.html, meanwhile, Google plans to eliminate support for “third-party” cookies in Chrome, just as Firefox and Safari already have.

  1. What’s the difference between a first-party and third-party cookie?

  2. What are, at least, two features of today’s websites that might break (i.e., stop working) if third-party cookies are disabled?

Base64

Per en.wikipedia.org/wiki/Data_URI_scheme, the below is an example of a “data URI scheme,” which prescribes a way to encode an image as text in “base64”, which is just another base system. Whereas binary has 2 digits and decimal has 10 digits, base64 has 64 digits. The URI below happens to encode a JPEG that’s 80 pixels wide by 80 pixels tall.

data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAAD/4QCMRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAFCgAwAEAAAAAQAAAFAAAAAA/+0AOFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAAOEJJTQQlAAAAAAAQ1B2M2Y8AsgTpgAmY7PhCfv/CABEIAFAAUAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAADAgQ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4AbzJZzZLt08M6guurW1sv/aAAgBAhEBPxAcNYfWDeLHCcHHhfVEG2EyYMn5ePgbsls3uwgPpbf/2gAIAQEAAT8Q3P8AgaUKlij/AIeKK5QnJYEvDh0E3QpZfnbs/juzZgVQDVeqNFVJRE7SOQdueIlTp3tMrp4uAY6mKp54skqIH5Ksd13A5j20Tw17qnTHJlLPPg/XJ1QzSJTPCzkGd2IzZAMAnCXGHH/OVeLmIqtHHs/d1EsbwVrYhPI8VKxWMMtDL6PmzAnBJNy+H8y1hlxjiEAmsJrB+6ZatzFYYox2BPdBMSE/5yrNc5PGiC/ClgGweWkosQ1rypKFGR8d1TxAiZkzZAlfQzxOwBwJXveaI3iCFOB9WI0En+7EPTikk+ahXDnmKAoBCEiUGgpAcxY4ODKpCJBg1IeUZkaYAfDs+WkCAcDgsSFEch7LPQQIETw3pJigJWDMk2HyDDeRlweG61BCHCaHnBBZGsASd3imTzFAdS7y7bPB6o6Zbn+6YoboJQMPn+S7WcUSLseo5s0w2Yj1cME6P6LLlAnmSoQKEH5vQwk4+a+SIktoud7ioSYGCuC8qkmR7UIhps3w5uWy060AIQ6Uv1eHUBAJiqSQOATnreaxULL20wB4IY+r0PBTlppAkwtkKXAPE+YsrhxQV9+axBAsAgH14sF9cFYBXQNWwkZXXj390WnIdTYw4vF9NkUbRggSaVIDUDIndTKEMuGk8wjVMgZ/K//Z
  1. Which 64 symbols does base64 use to represent data? Recall that binary uses 0 and 1 whereas decimal uses 0 through 9.

  2. What is the URI above a picture of? Read up on how you might embed it in a web page, and then whip up such a web page in CS50 IDE yourself to see! Remember to run http-server in a terminal window if you’d like to see your page!

Formal Opinion 477

If unfamiliar, read through americanbar.org/content/dam/aba/administrative/professional_responsibility/aba_formal_opinion_477.pdf, which offers guidance on how to protect communications with clients.

  1. How might an email sent over the internet from an attorney to a client be vulnerable to interception by a third party?

  2. If both attorney and client happen to have Gmail (or paid G Suite accounts), might their emails be more vulnerable or less vulnerable to interception?

  3. For especially sensitive (but still electronic) communications, what measures might an attorney and client take to communicate more securely?

Trusting Trust

In 1984, a computer scientist named Ken Thompson won the “Turing Award,” which is considered the “Nobel Prize of computer science.” In accepting the award, he gave this speech, <https://cdn.cs50.net/hls/2021/winter/assignments/final/Thompson_1984_ReflectionsonTrustingTrust.pdf. Not to worry if you don’t understand some of the code therein.

  1. Why can’t you trust code that you did not totally create yourself?

  2. Should companies or countries trust hardware created by other companies or countries? Why or why not?

  3. How can you, as a user, (try to) communicate securely using potentially insecure software and hardware?

Debrief

  1. About how many MINUTES would you say you spent on this assignment? Just to set expectations for future students.

How to Submit

  1. Download your completed assignment as a PDF by choosing File → Download → PDF Document, and save it to your computer.
  2. Go to CS50 for JDs’s Gradescope page.
  3. Click Final Assignment.
  4. Click Submit PDF.
  5. Click Select PDF and choose your assignment file.
  6. Click Upload PDF.
  7. Click the first question in the Question Outline at left, then click the page (or pages) on which your response to that question is located. Repeat this process for the remaining questions.
  8. Click Submit.

You should see a message that says “Final Assignment submitted successfully!”

If you run into any trouble with the above steps, email hls@cs50.harvard.edu!