Trying to understand the encryption used at various steps of Tor

So I read up on "Diffie-Hellman" key exchange which to my knowledge is a way for two parties to create a "shared secret" but I don’t really know if this is a public key or a private key or something else entirely.

When I look up how Tor works, many videos use the analogy of the locked box. We establish an entry node, relay node, exit node (call them A, B, C). I send a locked box to A who unlocks it and inside is another locked box with a message included, "send this to B." A sends this box to B, who unlocks it and sees another locked box with a note, "send this to C." B sends the box to C, who unlocks it and sees a message, "Fetch the contents of somewebsite.com" (the final request).

I don’t know if this analogy makes sense or if it’s even accurate.

Is this key exchange something that is done with the client and each of the three nodes, and that is how I am able to encrypt the message several times? Or is there some other algorithm used instead? I see that Tor uses RSA but I’m still unclear on how it all works together.

Trying to understand what is going on. It would help to see a minimal example using the actual encryption techniques.

What steps can I do if I know that someone[Goverment, Special agents,..etc] is spying on me?

if I know someone is trying to spying on me, and he/they tracking me on both online and reality, what steps can I do to neutralize the risk? keep in mind, that I’m a normal person with limited resources.

these steps comes in mind:

  1. Setup & use a self-hosted VPN service(to prevent ISP as Man-in-The-Middle and prevent DNS Leaks), on trusted hosting provider.
  2. Encrypt all my emails with PGP keys, and make sure that the usage of PGP keys is the default.
  3. Secure login to all chat apps, with Password/Fingerprint.
  4. Encrypt the full disk of my computer.

in general, I think of:

  1. Securing the communication on the internet (using VPN, fake identity, PGP Keys..etc).
  2. Securing the data on devices by encryption, and add authentication layers.

is there something more I miss?

minimum travel from point to point with incremental steps

It’s my first time to make a question here. I have a curious problem about algorithm, in the center of Cartesian plane (0,0) I need to go to another point (x,y) but I only can use horizontaly and verticaly steps and this steps increases one by one.

For example, I need to go to (1,1) point and steps are:

  • Go to (1,0), a step of 1 unit.
  • Go to (1,-2) a step of 2 units.
  • Finally, go to (1,1) a step of 3 units.

Obviously, there are several ways to go to a point from center but the problem needs the minimal.

Are there a formula or an algorithm to answer this question? Thanks for read this and for your questions.

How to transform robot motor steps into X/Y coordinates?

I have a robot with two motors A and B connected to wheels 21.6mm in diameter. The motors move in steps, and there are twenty steps for each complete revolution of the wheel. To make the robot move forwards, I turn on A and B in the forward direction and have it rotate a number of steps. To make it move backwards, I turn on A and B in the reverse direction. To get it to turn left, I turn on A and turn off B. Similarly to get it to turn right, I turn off A and turn on B. Using this scheme, I can get the robot to move in any direction.

My question is this: is it possible to transform the steps of motor A and motor B into the X/Y coordinates for the robot? For example, if I move the robot forward 10 steps, turn right 10 steps and move forwards again 10 steps can I calculate the X/Y coordinates of the robot? Assume that the robot starts at point 0,0.

What are the correct steps in solving polygon monotone triangulation?

I am working out enter image description here step by step and I am stuck on vertex 7. I got that it was a regular vertex and helper(e_i-1) is not a merge vertex so I look for the leftmost edge in the sweep line. My question is, would e6 be considered to the left of it, or is it none? Any already completed examples that I could see would help me understand this greatly.

Why is it impossible to iterate over all TMs with $n$ states and $k$ symbols that halt after $m$ steps on $\epsilon$?

Define $ \{\sigma(n,k,m,i)\}_{i=1}^{l_m}$ an ordered set of all TMs with $ n$ states and $ k$ symbols that halt after $ m$ steps on $ \epsilon$

There are $ (2kn)^{kn}$ TMs with $ n$ states and $ k$ symbols, so $ l_m$ is always finite and so is the range of $ m$ .

If we could iterate over $ \sigma$ given $ n,k$ for all $ m,i$ , then we could decide the halting problem:

  1. Get $ n,k$ from input machine
  2. Iterate over $ \sigma$ for all $ m,i$ and check for each one if $ \sigma(n,k,m,i)$ equals the input machine, if they are equal accept.
  3. Reject.

This is odd because It seems very feasible to constract $ \{\sigma(n,k,m,i)\}_{i=1}^{l_m}$ using elementary combinatorics. Even settling on a (computable) combinatorial formula for $ l_m$ for all $ m$ given $ n,k$ will be enough to solve the haling problem since we will know how many machines are there that halt for each $ m$ , and we can simulate one step at a time for all the $ (2kn)^{kn}$ machines and compare each machine that halts with the input machine until reaching $ l_m$ for all $ m$ without a correct comparison and reject.

Is there a fact (independent of it contradicting the Halting problem) that makes it clear why there is no computable combinatorial formula for $ l_m(n,k)$ ? or am I missing some detail here?

Find candidate keys – What are the steps

I have these following functional dependencies I figured out:

DM -> RA RDT -> AM AD -> RM 

I got with a software to calculate what the candidate keys were to this:

{R, D, T} {A, D, T} {M, D, T} 

But I don’t know HOW i should do this manually to figure out this. Not to use the actual software. What the steps are to solving this. First I thought I should do something like this to figure out the candidate keys:

DM+ = DMRA RDT+ = RDTAM AD+ = ADRM 

But from what I understand is that only the RDT+ is giving all the attributes for it to be a candidate key? I am so confused by this. How should I think to pick it out from these functional depedencies?