• 0 Posts
  • 16 Comments
Joined 2 years ago
cake
Cake day: June 25th, 2024

help-circle


  • To get every password, you’d have to exploit the password manager process itself. The manager asks you to approve every single password it hands out and you would know something is wrong if the extension starts asking for lots of passwords.

    The separation keeps the memory where the passwords are stored away from the browser. No malicious code executing inside the browser can access it. Also, the protocol between the extension and the manager can be really simple and (hopefully) easy to get right without making exploitable mistakes.

    It’s the Swiss cheese principle. The attacker has to break out of the website sandbox, get into the extension to copy the secret keys that are needed to impersonate the extension in the connection to the password manager, and exploit the password manager through that connection in order to get to the passwords. If any step fails (the holes in the cheese slices don’t align), the attack doesn’t get through.







  • Your daily weather forecast likely runs on FORTRAN. It’s quite terrible code in many places because the people writing it are not software engineers but meteorologists, mathematicians, or physicists with little to no formal training in software design writing a million-line behemoth.

    And FORTRAN adds to the suck because it is superbly verbose, lacks generics, has a few really bad language design decisions carried over from the 60’s, and a thoroughly half-assed object model tacked on. As a cherry on top, the compilers are terrible because nobody uses the language anymore – especially the more recent features (2003 and later).






  • x = 15

    Denote the origin of the circle O and the points A, B, C clockwise starting from the left. From the isosceles triangle OAB we get 2 r sin(alpha/2) = 24, where alpha is the angle between OA and OB.

    Construct the line orthogonal to OB that goes through C. The length of the line, h, between C and the intersection is h = 7 sin(beta) = x sin(90 - alpha). Denote the lengths of the parts of OB a and b, where a is connected to B. We have a + b = r

    Use Thales circle theorem to find that the triangle ABA’ completes the red shape, with A’ on the circle opposite to A. That means that the angle between A’A and A’B is alpha/2, but A’OB is also an isosceles triangle. So the angle on the other side, beta, has to be the same. Thus, beta = alpha/2.

    Now, put everything together: a = 7 cos (alpha/2), b = h cot(90 - alpha) = 7 sin(alpha/2) tan(alpha), r = 12 / sin(alpha/2).

    a + b = r <=> cos(alpha/2) sin(alpha/2) + sin^2(alpha/2) tan(alpha) = 12 / 7

    1/2 sin(alpha) + 1/2(1 - cos(alpha)) tan(alpha) = 12/7 <=> tan(alpha) = 24/7

    From the identity for h we know that x = 7 sin(alpha/2) / cos(alpha). Insert alpha = arctan(24/7)



  • I’ve been a four-star programmer a few times. Imagine a blocked symmetric matrix where the rows and columns are indexed by triples (u,v,w). The entries are zero whenever u != u’ or v != v’, and because of symmetry you only store entries with w <= w’. But the range of v depends on the value of u and the range of w on the value of v. So you do

    double ****mat = calloc (UMAX, sizeof(*mat));
    for (int u = 0; u < UMAX; ++u) {
      mat[u] = calloc (u + 1, sizeof(**mat));
      for (int v = 0; v <= u; ++v) {
        mat[u][v] = calloc (v + 1, sizeof(***mat));
        for (int w = 0; w <= v; ++w) {
          mat[u][v][w] = calloc (w + 1, sizeof(****mat));
          for (int ww = 0; ww <= w; ++ww)
            mat[u][v][w][ww] = some_function (u, v, w, ww);
        }
      }
    }
    

    and weep a little. In reality, this gets a bit optimized by allocating a single chunk of memory and carving that up into the pointer and data arrays, so everything is reasonably close together in memory.