Monthly Shaarli

All links of one month in a single page.

March, 2025

Zero-knowledge proofs – Vasek Rozhon's blog

A non-interactive zero-knowledge proof scheme: The prover commits (shuffle+lock) the graph N times: s[0..N]. He then calculate r=hash(s[0] || s[1] || .. || s[N]). And then he use the random bits in r generate N pseduorandom numbers c[0..N]. For each i=0..N, use c[i] to select a fixed edge in s[i] and reveal the keys k[i][0] and k[i][1] for the two nodes of the edge. The final message consists of s[0..N] and k[0..N][0..1]. The verifier is able to use these information to replay the steps to verify the prover's claim.

Another thing I learned from the video is how to "lock" messages cryptographically and allow the verifier to verify any message without revealing the others. First, the prover calculate h[i] = hash(m[i] || nounce[i]) and send h[0..N] to the verifier. The verify choose any integer t between 0 and N and send to prover. The prover will then send back (m[t], nounce[t]) to the verifier that h[t] is indeed calculated from m[t]. Here h[t] is the locked message m[t] and nounce[t] is the key.

I-BlockList | Lists

Various IP lists for download - useful for setting up firewall against attackers, malware, p2p, crawlers etc.

Secret Weblog • Succinct data structures

TIL succinct data structures - data stored in a compact fashion as in a compression, but the compact form itself has useful properties.

The Rank/Select Bit Vector is a bit vector equipped with two fast operations - rank and select. The rank operator returns the number of set bits up to the n-th bit. The select operator returns the index of the n-th set bit, i.e. inverse of rank. The data structure has nice uses as in string lookup, etc.

The Wavelet Matrix is a generalization of rank/select bit vector on non-binary symbols. Another data structure of the class is the FM-index, whose operators extend to working on patterns (substrings) instead of symbols.

Tracking You from a Thousand Miles Away!

I'd like to note the AirTag privacy-preserving tracking scheme I learned:

  1. the tag shares its key pair with its owning host as part of the pairing process
  2. the tag broadcasts its public key when away from its host
  3. nearby phones pick up the broadcast and send a location report to the apple server, which includes:
    • the phone's gps location encrypted using the tag's public key
    • the hashed public key of the tag
  4. the apple server store the location reports for each hashed public key
  5. the host can request the apple server to download location report for the tag using a public key. then it decrypts the gps location using the private key it got during pairing
calculator-app - Chad Nauseam Home

How can a calculator program perform an exact calculation involving arithmetic operations, roots, trigonometric functions, etc? It's a difficult task. Here is how it can be done.

  • rational type: bignum for both nom and denom
  • recursive real arithmetic (RRA):
    • represent a real number as a computation that maps from a precision value (a rational) to the rational result etc.
    • for composite expression, compute the precision value needed for each of its components (e.g. for 2pi to be shown with a precision of 0.01, pi needs to be calculated to 0.005 precision)
  • determine the exact equality between RRA
    • undecidable but decidable for a finite set of ops (proven by Dan Richardson, 1994), but slow
  • the optimization
    • represent every number as an exact rational times a RRA. (e.g. (3/2)pi)
    • hard code the common types of RRA (sin, log, ..) whose identity can be checked directly.
    • for uncommon types of RRA, just store RRA (e.g. pi * sqrt(2))

the result: the digits shown on screen are always 100% correct. 99% of calculation gets perfect UX.