HNHacker News
TopNewBestAskShowJobs

throwawaymath

5,982 karma · joined April 20, 2018

I've left. This used to be an enjoyable place to debate, but now it's frustrating to see ideologically driven downvotes on valid and on-topic comments.

I no longer have access to this account. If you want to reach me for past comments, you can do so at throwawaymathhn@gmail.com.

submissionscomments
throwawaymath··on Fast constant-time GCD algorithm and modular inversion
> What we have here in the cryptography sense is different: the running time n(c+n) clearly does depend on n; it just does not depend on the actual input.

Can you explain to me what the input is, if not c and n?

throwawaymath··on Fast constant-time GCD algorithm and modular inversion
The term "constant-time" is used in the complexity theoretic sense. Can you explain to me, concretely, how what you've said here

> as long as inputs have the same bit-length. Any 32-bit inputs will be handled faster than 1024-bit inputs, but any 1024-bit inputs will consume the same amount of time no matter their actual values. That is, 0x0001 and 0x000000001 are handled differently by the algorithm

indicates the algorithm is constant-time in one sense but not the other?

throwawaymath··on Fast constant-time GCD algorithm and modular inversion
> In cryptography the term "constant time" is sometimes used to mean a different concept, that the operation actually takes constant non-varying time, so that an attacker can't exploit this as a side channel to figure out the input values.

Note that I cited Thomas Pornin for my definition of constant time cryptography, who is a cryptographer in theory and implementation. It is emphatically not necessary for software to run with unvarying execution time in order for it to be "constant time" according to the cryptographic sense of the term. This will be a poor hill for you to die on, but I invite you to provide literature supporting your alternative definition.

throwawaymath··on Fast constant-time GCD algorithm and modular inversion
> The authors are not using "constant time" in the complexity-theoretic sense.

Yes, they are. I've already made a top-level comment citing the paper's explicit definition from Section 2 and comparing it to canonical definitions from the usual literature of algorithm analysis.

> That would mean an algorithm whose running time doesn't depend on n,c.

It does not. Note the exponent, 2 + O(1). It is true that the execution time varies with the input size, but this does not preclude constant time asymptotics.

> The GCD algorithm here has the property that (I'm quoting section 1.4 here) "the number of operations is ... asymptotically n (log n)^(2+o(1))". That is not constant as n varies.

Yes it is. Constant time does not mean that execution time does not vary, in either complexity theory or cryptography.

throwawaymath··on Fast constant-time GCD algorithm and modular inversion
No, I didn't misread. You and I are in (apparently violent) agreement. Constant time does not mean that running time cannot vary, in either complexity theory or cryptography. There are misconceptions on both sides here, with regard to what the terminology means in both complexity theory and cryptography.

For precision, I'll start with a good definition[1] for what "constant time" means in cryptography:

> Constant-time implementations are pieces of code that do not leak secret information through timing analysis. This is one of the two main ways to defeat timing attacks: since such attacks exploit differences in execution time that depend on secret elements, make it so that execution time does not depend on secret elements. Or, more precisely, that variations in execution time are not correlated with secret elements: execution time may still vary, but not in a way that can be traced back to any kind of value that you wish to keep secret, in particular (but not only) cryptographic keys.

Secure, constant time cryptographic algorithms need not have unvarying execution time. Now going back to complexity theory, it is also an extraordinarily common misconception that "constant time" means "the algorithm has the same execution time regardless of the size of the input." This is not the case. Big O notation doesn't even care about what always happens, it cares about what happens in the worst case. When we use "constant time" in the O(1) sense of the word, we are not precluding the possibility of an algorithm having variable execution time. Again, for precision, we are simply saying that the execution time (number of operations, etc) has an asymptotic upper bound which is independent of the input. The execution time may vary with the input, and generally speaking it will.

_________________________

1. Thomas Pornin, Why constant time crypto? https://bearssl.org/constanttime.html

throwawaymath··on Fast constant-time GCD algorithm and modular inversion
> I see how you may think that, but I would argue that I am not redefining anything, as things turn nonsensical without this assumption.

The point I'm making is that this statement reduces to the claim that defining an algorithm's worst case time complexity as O(1) or constant time is nonsensical.

Do you disagree that adding two numbers is a constant time operation?

throwawaymath··on Fast constant-time GCD algorithm and modular inversion
Ah, I misspoke. I meant "access", you're correct about searching. The original link I cited for explanation still applies.
throwawaymath··on Fast constant-time GCD algorithm and modular inversion
It's pretty frustrating to see the discussion on this submission dominated by people litigating the "constant time" terminology. The authors, Bernstein and Yang, are using constant time in the conventional, complexity theoretic sense of the word. Here is a quote from Section 2, "Organization of this paper":

> We start with the polynomial case. Section 3 defines division steps. Section 5, relying on theorems in Section 4, states our main algorithm to compute c coefficients of the nth iterate of divstep. This takes n(c + n) simple operations. We also explain how “jumps” reduce the cost for large n to (c + n)(log cn)^2+o(1) operations. All of these algorithms take constant time, i.e., time independent of the input coefficients for any particular (n, c).

In particular note that last sentence. The asymptotic runtime of the presented algorithm does not depend on the inputs, n and c. This algorithm analysis is confirmed throughout the remainder of the paper, which walks through each stage of the algorithm. Now let's look at a few canonical definitions of "constant time", i.e. O(1).

From Skiena, we have:

Constant functions - f(n) = 1 - Such functions might measure the cost of adding two numbers, printing out the "Star Spangled Banner", or the growth realized by functions such as f(n) = min(n, 100). In the big picture, there is no dependence on the parameter n.

Likewise from Sedgewick & Wayne:

Constant. A program whose running time's order of growth is constant executes a fixed number of operations to finish its job; consequently its running time does not depend on N. Most Java operations take constant time.

I'll update if I find a choice example from Knuth in TAOCP, but I think this suffices. The discussion about whether or not the cryptographic use of the term satisfies the complexity theoretic sense of the term is a red herring; it's a distinction without a difference. Algorithm analysis focuses on asymptotic behavior, which is definitionally given by tail behavior, or rate of growth of a function. Among other things, this paper is not about an implementation methodology that ensures the GCD algorithm will take exactly the same amount of time regardless of the input.

______________________

1. The Algorithm Design Manual, 2nd Edition, § 2.3.1 Dominance Relations, Page 39

2. Algorithms, 4th Edition, § 1.4 Analysis of Algorithms, Page 187

throwawaymath··on Fast constant-time GCD algorithm and modular inversion
That's not how this works. What you're doing here is defining away the scope of the problem to make O(1) complexity analysis redundant. A bound of O(1) conventionally means that we can exploit some structural component of the input and the given problem to find a solution independent of the input size. If you redefine input size to the more narrow sense of inputs which don't have some sort of structural feature like that, then yes of course nothing is constant time. But then you're just shifting the difficulty of the problem around without much of a gain.
throwawaymath··on Fast constant-time GCD algorithm and modular inversion
> it's not "constant time" in the sense of having O(1) time complexity with regards to the size of the inputs

Yes it is. The presented algorithm is constant time in the exponent, i.e. 2 + O(1), where this exponent is not impacted by the size of the inputs n and c. Much like any other complexity analysis, an algorithm is O(1) as long as O(1) is asymptotically the "largest part" of the running time. As the size of n increases, the exponent 2+O(1) increasingly dominates execution time.

throwawaymath··on Fast constant-time GCD algorithm and modular inversion
> I cannot think of any algorithms with arbitrary sized inputs that have truly constant execution time.

With respect, I think you may misunderstand the meaning of "constant time" in the sense of complexity theory, i.e. O(1). Accessing an element in an array of size n is a constant time operation. See: https://stackoverflow.com/questions/7297916/why-does-accessi...

EDIT: Corrected "search" to "access"

throwawaymath··on Fast constant-time GCD algorithm and modular inversion
> A simple example of constant-time within this definition, as well as why constant-time does not mean O(1) in this context, is that of a comparator:

This is incorrect. The paper explicitly uses "constant time" in the sense of O(1). You can see this listed throughout the paper, in various complexity analyses, beginning from Section 2.

throwawaymath··on Fast constant-time GCD algorithm and modular inversion
This is incorrect. Refer to Section 2, "Organization of the paper":

> We start with the polynomial case. Section 3 defines division steps. Section 5, relying on theorems in Section 4, states our main algorithm to compute c coefficients of the nth iterate of divstep. This takes n(c + n) simple operations. We also explain how “jumps” reduce the cost for large n to (c + n)(log cn)^2+o(1) operations. All of these algorithms take constant time, i.e., time independent of the input coefficients for any particular (n, c).

What the authors are doing is (in the simplest sense) adding a worst case O(1) component to the GCD algorithm in the exponent. This is fundamentally a complexity theory paper, and Bernstern and Yang are using "constant time" in the complexity theoretic sense.

Moreover this is not about clever implementation; the algorithm they present will explicitly not take the same amount of time regardless of the input. In line with the presented complexity analysis throughout the paper, the worst case running time is asymptotically bounded independently of inputs n and c.

throwawaymath··on Account Deletion
As a counterpoint, it drives me nuts when I see a graveyard of deleted comments on reddit. Do you want all your activity to vanish or do you just want to disown the username?

I think a fair compromise would be to simply delete the account name associated with comments.

throwawaymath··on An Infinitely Large Napkin
Adding this here as it may be of related interest for those who enjoyed the massive math cheat sheet on the front page recently. Evan Chen, a math student at MIT, wrote up what would be considered field notes for higher mathematics. The full PDF is here[1], complete with a dependency graph showing what you need to know before reading any particular section.

____________

1. https://usamo.files.wordpress.com/2019/02/napkin-v15-2019022...

throwawaymath··on You probably don’t need ReCAPTCHA
Extremely common. Most hedge funds buy what's called "alternative data" from vendors who aggregate it, like 7Park. The data is collected by providers who collect it from location telemetry, web scraping, satellite imagery, etc. Scraping from web applications is one of the more common forms.

The more successful quant funds will often build out internal research teams to do this. For example, both Two Sigma and Millennium have (not so well advertised) research teams devoted to this kind of data collection internally.

throwawaymath··on You probably don’t need ReCAPTCHA
That's what mechanical turk is.
throwawaymath··on You probably don’t need ReCAPTCHA
To be clear, I don’t have a horse in this particular race. I’m neither condemning nor condoning the market dynamics of sneaker arbitrage here. It’s just an example I’m very familiar with because I used to write scrapers and I’ve been offered silly amounts of money to make them for sneaker trading groups. Not as much as hedge funds will pay for writing crawlers for market research, but still more than you’d probably expect just so they can flip Supreme shirts and Yeezys faster than competitors. It’s ridiculous, but this is the world we live in. The point is simply that when the stakes are high (particularly when there is money to be made), stopping adversaries will be really, really difficult.

Back to the point at hand, I don’t like recaptcha in principle. But given my view from both sides of the table, it’s one of very few things that consistently works for sophisticated adversaries. It’s about as close to a silver bullet as they come, with the additional upside that it’s the absolute easiest thing to implement - in both an absolute sense and relative to the return. And once you have, most of what you can implement beyond recaptcha has diminishing returns in comparison.

All of that being said, I would be inclined to agree that most websites and apps don’t need recaptcha, simply because most of them aren’t worthwhile targets for the types of attacks recaptcha is singularly effective against.

throwawaymath··on You probably don’t need ReCAPTCHA
Other commenters have basically answered already, but to be clear Luminati is not the only provider, just the most infamous. It’s very easy to find others of greater or lesser reliability. Search “residential IPs proxy” and you’ll find many vendors.

But yes, the whole cottage industry is sketchy. Almost all providers are leasing users’ computer with outright malware or shady TOS. The savvy play is to release a free game, app or even SDK which will then opportunistically route requests from the control server through the user’s device.

Recaptcha solving APIs are frequently bundled with the more reliable and premium services of this kind. They introduce a lot of latency since there’s a real mechanical turk across the world solving it for you, but they basically work.

throwawaymath··on You probably don’t need ReCAPTCHA
> Are robots emulating people from an iPhone?

Many of the more sophisticated ones prefer emulating mobile application requests to web requests, so yes.

throwawaymath··on You probably don’t need ReCAPTCHA
As the commenter said, they rotate IPs. It is not that easy. I've also been on the other side of a sophisticated attack like this. The really savvy adversaries do the following, at least:

1. Rotate through several thousand to several hundred thousand noncontiguous, geographically distributed, residential IP addresses,

2. Associate each IP address with a single user agent and suite of cookies,

3. Associate each IP address with a particular target username,

4. Only attempt a few incorrect logins at a time, and a somewhat random (albeit realistic) number at that, within a given time interval,

5. Use random, apparently human delays between successive requests,

6. Issue requests using extremely high fidelity simulacra of web browsers, customized to the sequence and structure of HTTP requests on the website.

When the stakes are high this is the kind of opposition you'll get. Bank account takeover, social media account takeover, ticket scalping, automated sneaker buying, financial research, market research, etc.

Recaptcha introduces unpleasant user friction, but it usually works well. To invert a popular turn of phrase, it makes stopping simple attackers easy and hard attackers possible. The most sophisticated attackers will still lease reputable Google accounts and mechanical turk time to bypass Recaptcha challenges, but it will be expensive for them.

Technical sophistication is only one dimension of this game. The other is making adversaries spend more money than they can gain from being successful.

throwawaymath··on Ask HN: Where to Connect with Algo Traders?
Join #R-finance on Freenode. Contrary to the name, the channel is a watering hole for all things quantitative finance, not just R. Several of the frequent members happen to be involved in the R community.
throwawaymath··on Matlab–Python–Julia Cheatsheet
Oh that's neat. Thanks, I wasn't aware of that.
throwawaymath··on The Mathematical Hacker (2012)
In the future, I really don't think the vast majority of software engineers will need to know any abstract algebra in order to use or write software with strong formal guarantees. The history of software engineering (and most engineering disciplines in general) is a narrative in which practitioners need to know less theory as time goes on.

I expect that formal methods will become another specialization that most engineers don't need to directly work with, alongside things like cryptography and low level arithmetic.

throwawaymath··on The Mathematical Hacker (2012)
Unfortunately I have to strongly disagree with the author's central thesis.

> But I think that most programmers who are serious about what they do should know calculus (the real kind), linear algebra, and statistics. The reason has nothing to do with programming per se — compilers, data structures, and all that — but rather the role of programming in the economy...One way to read the history of business in the twentieth century is a series of transformations whereby industries that “didn’t need math” suddenly found themselves critically depending on it.

There are two ways to interpret the claim that more programmers should know advanced math. One of them, which the author preempts, is the idea that programmers will improve their own work through significant mathematical maturity. It seems the author and I already agree that isn't the case, so I won't address this interpretation. But I still consider this interpretation to be more defensible than the other one.

The other way to interpret it, which the author seems to be explicitly pushing, is that programmers with a strong mathematical background will be better situated to proactively find fertile areas of the economy which can be improved through a combination of computing and advanced math. I don't believe this is realistic. None of the author's specific examples - control theory, optimization, linear programming, econometrics, or Black-Scholes - were pioneered by generalist engineers with a strong grounding in mathematics. They were just applied mathematicians (and in a few of those cases, repurposed pure mathematicians).

Likewise the bar is constantly rising. Knowing calculus, linear algebra and statistics won't empower you to make significant, groundbreaking improvements to any major field. That knowledge is necessary but insufficient. What's considered low hanging fruit these days is something that could be conceivably noticed and tackled by a postdoc. Mathematics itself is ossifying as a field of specialists, to the point where prominent researchers within subfields like algebraic geometry can be unfamiliar with each other's principal work.

This is really why find the appeal to economic advancement less than convincing - every advancement the author mentions has an implicit foundation in specialization. Historically, the most notable advancements in technology have come about through division of labor and cross-pollination. You would be better served by having two collaborating teams of mathematicians and engineers than by a team of engineers who know undergraduate math. It's already common for applied mathematicians to be able to program competently; they dominate the authorship of fast, low level math libraries. If you need them, hire them.

Conversely, I would argue we should actually reduce the education for more developers, not add even more material to it. Most developers already don't need to learn a significant amount of the material in a standard computer science degree. Piling on math courses isn't going to be a fundamental improvement for the vast majority of engineers working on real world software.

throwawaymath··on Matlab–Python–Julia Cheatsheet
Julia takes after Matlab, where matrices are defined by enumerating each row followed by a semicolon. Personally I prefer Mathematica's syntax, but the Julia/Matlab syntax is still way better than Numpy syntax (though to be fair most of that is due to the lack of native matrix support in Python).

If it helps at all, this is exactly what you'll see when you create a matrix in Julia:

    julia> mat = [1 2; 3 4]
    2×2 Array{Int64,2}:
     1  2
     3  4
throwawaymath··on Matlab–Python–Julia Cheatsheet
Good catch, that's an odd mistake. I would assume the author knows the adjoint isn't equal to the transpose unless the matrix is real.

If you only ever work in R then technically that'd be fine (though notationally awkward). But that's not a good habit to keep since it would introduce pretty insidious bugs if you ever take the adjoint of a complex matrix intending to take the transpose.

throwawaymath··on ROT13: good version
If it's sufficiently well-specified, sure, why not?
throwawaymath··on People with Greater Intellectual Humility Have Superior General Knowledge
Well yeah, that's why I continue to ask. I guess what I was getting at is that I'm sort of shocked people will still bullshit despite my explicit declaration ahead of time.
throwawaymath··on People with Greater Intellectual Humility Have Superior General Knowledge
Likewise. I open my interviews with the explicit statement that I’d like them to disclaim when they don’t know, and that furthermore, the discussion is arranged around challenging them until we reach that point. We have less than an hour together and I need to judge your technical abilities in an intrinsically imperfect medium. Help me help you - I can only work with what I’m given. If you bullshit, what I’m given isn’t good.

I don’t really get it. I can perhaps understand that some candidates might have gotten good feedback from blatantly guessing in the past, but that’s why I now explicitly tell them to disclaim guesses. If anything it looks more impressive when you honestly don’t know something but intuit the substantially correct answer (as long as it’s something that could be realistically intuited).

Yet even with my disclaimer, I’ve still conducted phone screens and onsite interviews where the candidate eventually started bullshitting. It’s one thing to say you don’t know and give a wildly incorrect answer - at least then I can try and steer the interview towards another of the candidate’s strengths. It’s even okay to preface your wild guess with an, “I think...”. But the cavalier way in which people will just spout nonsense is disturbing. Even if you’ve been performing well up to the point, engaging in bullshit is nearly immediate grounds for me to discount you as a candidate.

← PreviousPage 6 of 34Next →