Rarely Asked Questions - <AUTHOR> http://paulgraham.com/raq.html <comment><USER3> Oh my god are developers pompous.

So, the problem with Hegel is that he didn't study LISP and startups enough to understand his own thought. If only he were alive to ask for Paul Graham's help!

OK my turn! I'm going to post on a social sciences website that Paul Graham doesn't really understand LISP because he hasn't studied... uh, Slavoj Zizek enough.

<comment><USER4> (Somewhat tangential) Is Slavoj Zizek a "real philosopher", or a troll? I found him through a reference to qanda someone had posted here, and I'm pretty sure it's a troll.

<comment><USER5> He does have a PhD in Philosophy from a university in Slovenia. However, he's generally lumped in with the post-*-ist critical theory crowd. When he does his inexplicably popular academic guest lectures he's sponsored by the cultural studies department, not the philosophy department (unless it's a philosophy department with a non-analytical bent, like the New School).

He is definitely a troll, though. That's kind of his thing. I think he would even agree with that label.

[http://www.nydailynews.com/blogs/pageviews/2013/03/why-we- sl...](http://www.nydailynews.com/blogs/pageviews/2013/03/why-we-slober-over- slavoj-žižek-or-how-to-be-incomprehensible-and-relevant-at-the-)

</comment></comment></comment><comment><USER6> I'm not going to insult one of the patrons of these pages, however, I do note:

 _Paul is the author of On Lisp (Prentice Hall, 1993), ANSI Common Lisp (Prentice Hall, 1995), and Hackers & Painters (O'Reilly, 2004). He has an AB from Cornell and a PhD in Computer Science from Harvard, and studied painting at RISD and the Accademia di Belle Arti in Florence._

 _What I learned from trying to study philosophy is that the place to look is in other fields. If you understand math or history or aeronautical engineering very well, the most abstract of the things you know are what philosophy is supposed to be teaching._

It depends what type of Philosophy you're studying. Formal Logic: I can see the argument that with a strong Mathematical background & CS, you've already learned (most) of the tricks (although, this largely misses the point that most of the great Mathematicians of the 20th C also dabbled in the Philosophy of Logic - famously Gödel etc).

The _other_ kind of Philosophy inhabits the same mental space as Art (ahhh, Florence!). This is a common issue with American Nationals, as American (and to some degree, British) philosophy is mired in Behaviorism, Philosophy of the Mind (which does make me cry a little inside when they don't keep up with neuroscience or even know anything about Complex Systems Theory) and other schools.

Ethics and Morality? Reaching those Creative spaces of the Sublime and so forth? Aesthetics? All fields I assumed the author would be interested in, given his Artistic leanings, and all fields that Philosophy is very useful to read on.

And, as a friendly note: I'm not sure _aeronautical engineering_ can teach you much on that, barring of course: if you build it wrong, Death is _certainly_ going to be the Horizon you hit.

<comment><USER7> > Philosophy of the Mind (which does make me cry a little inside when they > don't keep up with neuroscience or even know anything about Complex Systems > Theory)

Can you explain more on this? I understand more neuroscience/complex systems than I do philosophy; back in school, I became skeptical of the meaningfulness of the research done in complex systems. I would be curious as to what you think it can contribute to philosophy.

<comment><USER6> I'm unsure of how technical to make this, or what your background is, however:

Let's take a "classic" of Dennett's[1], against the "brain in a vat"[2]; from what you know about _feedback loops_ or _dynamical systems_ would the proposition of imagining a 'brain in a vat' ever make sense to you? (Note: it's not merely a Matrix style imagining, you have to _prove_ it's not happening - you may well consider this a pointless experiment, of course).

I suspect not. That is to say, if you learned about Complex Systems prior to reading the debate over 'brain in a vat', the entire argument would probably strike you as absurd (I may be projecting here, feel free to say otherwise). This is where I presume Paul is coming from: _" Well obviously no, what a waste of time"_. However, proving it _logically_ is precisely what a lot of Philosophers have spent time doing (as opposed to wiring the brain up, not something that was technically possible until very recently). There's value in the logic of it, and the thought, _because it is such a common human misconception_ (that the mind / consciousness is separate to the body, or the world or the universe).

Does that make sense?

[1][http://www.ted.com/talks/dan_dennett_on_our_consciousness.ht...](http://www.ted.com/talks/dan_dennett_on_our_consciousness.html) [2][http://www.iep.utm.edu/brainvat/#H5](http://www.iep.utm.edu/brainvat/#H5)

<comment><USER8> I think you'll find that (a) Dennett knows a lot of things you're assuming he doesn't, (b) that whether a brain in a vat is plausible is not easily answered by appeal to complex systems theory, and (c) that the role of thought experiments in philosophy is more complicated than you make it out.

Also, the link to TED is broken.

<comment><USER6> Well, thank you for the hostile tone.

a) I in no way critiqued Dennett - in fact, you'll notice that my last statement about how mind / consciousness is _not_ separate to the body, or the world or the universe is _explicitly his position_ (of course, he is deeper than that, but at the level of my response, it was clearly in line with his thought).

b) That was the point: how you failed to understand that I was making a Category case I'm not sure. We are, after all, responding to the accusation that "No philosophy is worth reading". I was making an argument of how a Scientific / STEM background _might_ make philosophy seem "pointless", and was taking the position of the argument, not my own, and attempting to answer it gently (it's called empathy, dear, learn some).

c) You've totally misunderstood my entire argument, and as such I think it embarrassing on your behalf that you've been so confrontational.

I'll disengage - you failed to understand what was being said, you failed to acknowledge that I was uncertain of how technical to make the argument, so pitched it at a Ted Talk level, and you were rude. Not interested, _especially_ if you cannot understand the point being made.

I have fixed the link, however.

</comment></comment></comment></comment></comment><comment><USER9> _Why don 't more painters have hacking jobs?_

Most painters I know are Luddites. Especially well-established ones. They think that resisting technology gives them some kind of higher moral ground point of view. They believe that technology sucks people into an alternate reality where they lose contact with the real world and thus become insensitive to the problems of modern societies.

<comment><USER10> I'd love to pick up a book that deals with this issue: why and when painters - and more generally artists - have come to adopt this anti-technological outlook.

Was it a fear that the pervasiveness of technology would make their craft(s) obsolete?

This sort of thinking is rife even within artistic circles.

Artists whose medium is photography are like the ugly lepers of the visual art world.

I find this anti-technological bent in modern Western cultural life particularly unsettling.

Don't take what I'm saying to an extreme; I have nothing against consumable art in its many forms.

However I think the cultural life of cities in the West - in its various forms (art, theatre, cinema, classical music, architecture) are ruled by cohorts who wholly constitute the anti-technological fringe.

They live for abstraction and something about that makes them virulently anti- technological.

Suggest a book or essay that addresses this issue in great depth.

<comment><USER11> I don't think artists as a whole have a particular aversion to technology, unless you specifically define art to exclude all the technologically influenced art, in which case it becomes true by construction.

There are huge areas of art based on strong engagement with technology, and art/tech crossover types who write code and build stuff as part of making their artworks are the norm in those. Areas like new-media art, electroacoustic music, cybernetic sculpture, etc. basically require crossover, and they are definitely more vibrant scenes these days than oil-paint-on- canvas is. This journal's been around since 1968: [http://en.wikipedia.org/wiki/Leonardo_%28journal%29](http://en.wikipedia.org/wiki/Leonardo_%28journal%29). Some miscellaneous people whose work is interesting in that vein: Julian Oliver, Roy Ascott, Toshio Iwai, Edward Ihnatowicz, Nam June Paik, Cory Arcangel. More examples (tilted towards recent stuff) can be found in this online database: [http://rhizome.org/artbase/](http://rhizome.org/artbase/)

Computer-music is particularly well established, with 5-6 journals and numerous conferences and exhibitions, as well as centers like IRCAM and CCRMA. I think actually if you take well-known post-WW2 composers, a substantial proportion come out of the tech-crossover angle, folks like Steve Reich (tape loops) and Iannis Xenakis (digital synthesis, granular synthesis).

Of course, there are areas of art that don't care about technology either. And they're somewhat overrepresented in the establishment "cultural life of cities in the West", because that tends to take a very conservative, backwards- looking view. It's all about upper-middle-class people taking in high culture as it existed in the 1920s and earlier: classical music, paintings from the great masters, Renaissance sculpture, the standard repertoire of operas, etc.

<comment><USER10> The areas of composite art you mention hardly have a fraction of the sweeping brushstroke of influence and the ability to impress upon society, certain mores and affectations that the more established forms of art (that you refer to in the last line) have.

It is by no means an exaggeration to say that most people who patronize art in cities and wealthy donors who lavish large sums on money on museums, opera venues, orchestras and various other ventures that promote art, probably have never heard of the crossover types you mention.

Hence it is fair to say that these newer art forms barely register in terms of their influence on the popular mood of the culture of a city much less a nation.

It is no secret that berating the ills of technology is Hollywood's favorite past time.

From Fritz Lang's Metropolis to Terminator to the recent Prometheus and a million flicks between them portray in no ambiguous terms the banes of unchecked technological advancements.

Ignore that for a moment.

The scuttling of technology, even when it could greatly aid and enable a better experience, can be seen in sports as well.

FIFA is a notorious luddite. They act as if the soccer gods will strike with lightning if they so much use an instant-replay.

The overlords at the French Open won't even touch Hawkeye with a ten foot pole. Players have to resort to pointing to where the ball left an impression on the clay to argue for a point that could decide their fate.

I only know of the NHL that embraces an uncommonly high amount of technology to make better ruling decisions. Every goal of every game is reviewed remotely in Toronto just to be sure. Offside calls and a host of other decisions are still handled by a couple of on-ice referees.

All said this technology-hating nonsense and the morons who advocate such superstitious dogma are everywhere.

I pray for the day when this bullshit will be called for what it really is - <USER2> form of a hate crime, an intolerance of reason and utility.

</comment></comment></comment></comment><comment><USER12> I think the problem with philosophy is that language and words only go this far and we humans get tired fast when just thinking hard inside our heads without any interaction with the external world and no real-world problem to solve. I believe it was the book "The Three Pillars of Zen" that illustrated this effect by comparing the posture of Rodins Thinker [1] with the posture of a meditator [2]. So not only do we run circles around our own concepts that are most likely grounded in the unconscious, but we also get very tired, irritated and depressed from it, that's at least my experience.

[1] [http://en.wikipedia.org/wiki/The_Thinker](http://en.wikipedia.org/wiki/The_Thinker) [2] [http://www.sacred-texts.com/bud/cob/img/buddha.jpg](http://www.sacred- texts.com/bud/cob/img/buddha.jpg)

<comment><USER10> Perhaps I haven't followed you to a T.

What specific problems or arguments in philosophy are not easily illustratable, using plain language?

I do understand that some thoughts and experiences of the human order may not be easily captured or made intelligible by language.

I guess you could slot the experience of a color-blind person in that category. Especially in the past when testable apparatuses have not yet been developed to even diagnose that such a medical condition does indeed exist.

However I fail to understand why most philosophical arguments cannot be made intelligible to laymen.

René Descartes' "Brain In The Vat" argument is quite easily comprehendable.

It is my opinion (and very often found to be true) that most obtuse arguments (philosophical or otherwise) are indeed "highly technical stuff that doesn't matter much, or vague concatenations of abstractions their own authors didn't fully understand."

In fact I think PG is being charitable. I wonder if the "highly technical stuff" that doesn't lend itself to the peer review of more than a handful of scholars is even valid and credible in the first place.

I know that I am going down the slippery slope of If-I-and-most-non-scholarly- people-of-above-average-intelligence-cannot-grasp-an-argument-then-it-must-be- patently-invalid-and-thus-hogwash.

However at times I wonder if it is indeed possible that the scholarship of even a fraction of the world's most esteemed scholars (in various fields) actually has some validity and truth value associated with it.

Since nearly all of it is produced in academia and thus only subjected to the scrutiny of academic peers.

I wonder if it is just a nice formal product of a large volume of essentially meaningless cogitation that passed the consensus of equally unworthy peers.

This has to be true especially in the more arcane disciplines where there is little oversight or cross-disciplinary activity.

I'm sure there is a name for this phenomenon. Something on the lines of "legitimacy by consensus".

<comment><USER12> I simply get very tired very quickly when reading philosophy, not because I find the arguments difficult but because those works never seem to get to any conclusion regarding the problems being considered and there is anyway no way to validate what is being said with the external world or apply it to anything. It's a bit like closing your self in a room and talking to yourself for prolonged amounts of time, there is something unhealthy to the human psyche and from observing other people I see that the more someone contemplates things like "meaning of life" the more unhappy they become. Now with this observation in mind I try to come up with some explanation of this phenomena.

Imagine a neuroscientist watching a person contemplating a so-called philosophical problem, like "what is beauty?". You have a part of your brain that is responsible for language and discourse and inner dialogue and most likely a completely separate part that is capable of the emotions you experience when seeing what you personally call beauty. Now that language part is capable of creating a great number of the most wild hypothesis about what beauty is, but the part that really perceives beauty and creates the associated emotions operates completely unconsciously so you have no chance to capture with your conscious self what beauty "really" is to you. So all this "philosophizing" is just your brain chatting random things somewhat related to the concept of "beauty", but there is no purpose to it, no conclusion, no validation and all this you could just experience some beauty somewhere instead.

</comment></comment></comment><comment><USER13> For those interested in a broad account of history that does not try to explain _what_ happened, but _why_ things happen, I highly recommend Jared Diamond's _" Guns, Germs and Steel"_[1]. It resonates well with the hacker's desire to understand what makes the world tick :)

[1] [https://en.wikipedia.org/wiki/Guns,_Germs,_and_Steel](https://en.wikipedia.org/wiki/Guns,_Germs,_and_Steel)

</comment><comment><USER14> Regarding adding macros to Python, the new language Julia, which is fairly Python-like in appearance, has them: [http://julialang.org/](http://julialang.org/)

Like Lisp, Julia is completely homoiconic. Zach Allaun at Hacker School, formerly a Clojure guy, has been doing lots of cool stuff with its macros, like this one to make tail-call optimization available (not natively a feature of Julia): [http://blog.zachallaun.com/post/jumping- julia](http://blog.zachallaun.com/post/jumping-julia)

The infix syntax serves to make Julia macros a bit uglier and more complex than Lisp ones, but they still provide the same power.

Edit: Here's a link to the Julia docs on metaprogramming: [http://docs.julialang.org/en/latest/manual/metaprogramming/](http://docs.julialang.org/en/latest/manual/metaprogramming/)

</comment><comment><USER15> _But it would be hard to do that without creating a notation for parse trees; and once you do, your language has become a skin on Lisp, in much the same way that in OS X, the Mac OS became a skin on Unix._

TIL Julia is a skin on Lisp.

 _It can be interesting to study ancient philosophy, but more as a kind of accident report than to teach you anything useful._

Couldn't agree more, ancient philosophy (and most of contemporary philosophy) is a complete waste of time.

<comment><USER16> > TIL Julia is a skin on Lisp.

It actually is more so than you might imagine. If you have julia installed try `julia --lisp` ;).

</comment></comment><comment><USER17> My favourite history book that I've recently read:

Simon Sebag Montefiore's Jerusalem: The Biography - amazing work of scope, depth and human understanding.

I also studied philosophy as a degree and agree there are no really great introductions. I finished my degree somewhat disengaged with the subject and haven't pursued it seriously since. My favourite book though was John Rawls' A Theory of Justice.

</comment><comment><USER18> > Can you add macros to python

Yes [https://github.com/lihaoyi/macropy](https://github.com/lihaoyi/macropy)

</comment><comment><USER19> It is not exactly a history book but Guns, Germs, and Steel should be on the reading list. It starts at the dawn of modern humans and explains a lot about how the world is organized.

It started with a simple question from a New Guinea native to an anthropologist of European descent: "Why do you guys have all the loot?"

Hint -- it's not because of smarts.

</comment><comment><USER20> One issue I've found with studying history piecewise like this (basically how history is taught in school…) is that you don't get a good global picture of an era. What was happening in China at the time of the Roman Empire ?

<comment><USER21> Is getting a good global picture a particularly high priority in most historical studies, particularly more ancient civilisations?

There's little if any overlap between the two (unless you're thinking of things like the effect of steppe tribes moving from the east into Europe), so I'm not sure you'd get a better understanding of either Roman or Chinese history by treating them as a single story.

If you are personally particularly interested in that, isn't the answer to simply read both a book about Rome and one about China from a similar time period?

</comment></comment><comment><USER22> <More Riffs on PG on Philosophy>

Philosophy is wasted on the young. The great tragedy of Socrates death is that the democracy had a point. If it's any consolation, Socrates was not just a man, Socrates was old.

Academic Philosophy is not as interesting as LISP. Don't hold that against them, for millennia philosophers have suffered ignorance of the lambda calculus. The current fascination with Brainfuck is but a passing paradigm.

DSL's show Wittgenstein wrong about private languages. This would prove to Wittgenstein on his own terms that he had misused language and accidentally slipped into philosophy.

C. S. Pierce was a working scientist. He shipped his side project. When the academics got ahold of it, we got psychology. The PHB is a side-effect.

When philosophy gets back to basics and focuses on thinking clearly, a LISP will be part of the curriculum. Arc as a 100 year language is a dip-shit exit.

</comment><comment><USER23> I like "RAQ" acronym. I've always hated "Nerd Stuff", "Technical Questions" and similar titles on pages that answer not so popular questions.

</comment><comment><USER24> Riffs:

<<Why don't more painters have hacking jobs?>>

I think pg is right in highlighting age here. Generally speaking you need to get started young. Beyond this, there is a natural synchronicity in all "arts" when engaged at a high level, which is why the renaissance produced true "renaissance men." The trick is to start early but resist the all too common impulse to mediocrity in the context of specialization -- pg's association with elite institutions certainly helps here.

<<What should I read to learn more about history?>>

I find pg slightly misguided here. One of the world's best historians was my former advisor (Martin van Creveld), and his technique was to find a subject that he could fall in love with and immerse himself in it passionately for a year or two (ultimately however long it took him to write a book about that subject). I think a strong passion for a particular subject can make up for the otherwise dense and uninteresting material. Looking for books that make things "exciting" is a recipe for an understanding of history that is as piecemeal as one's own reading habits.

<<Couldn't you add something equivalent to Lisp macros to languages like Perl or Python?>>

Yes, of course. One could also quote the apocryphal McCarthy / Norwig story here.

<<How can I avoid turning into a pointy-haired boss?>>

Starts off generally correct and "startups" are certainly one solution to this problem, but I'm not sure they are the only solution. For instance, this basically assumes that your startup can exist as a flat organizational structure with only hyper-intelligent and interesting people. But what if, heaven forbid, you need to add a customer service division?

The truth is that really smart people generally don't want to be middle managers in large firms. The work isn't that interesting, and the compensation is to a certain degree adjusted more highly to compensate people for walking around in suits and clucking their tongues all day. Rather than pointing finger with the negative stereotype ("pointy-haired boss"), I think it is more appropriate to think of these people as corporate trash men, compensated more highly because of a generally undesirable job (after all, managing Dilbert and Dogbert probably isn't a recipe for life long engagement).

<<I'm about to become a teacher. How can I be a good one?>>

Agree. Probably a lot that could be added here about how to engage personally with students, although this goes beyond mere "teaching" to "mentorship"

<<Two startups want to hire me. Which should I choose?>>

Perhaps strangely, I generally disagree with the principle that you should go with the startup that is more likely to succeed. I think you should find the subject that you are personally most passionate about and pursue it with all the passion you have. Since you give a sh*t (a rather rare things these days), you will naturally become very good at that particularly area. Only then find startups in your particular area of interest. They should all want to hire you. Then, of course, you will pick the one that matches your passion, which should be the one that is executing most successfully towards their stated goal.

<<How can I become really good at Lisp programming?>>

I'm not very good at Lisp...

<<What philosophy books would you recommend?>>

Very tricky topic and a bit "recursive," in that pg references "what philosophy is supposed to be teaching" without defining it -- this in itself obviously a "philosophical" question.

Also, it's not at all clear from the response what pg has actually read. There are quite obviously a lot of genres of philosophy. Some of them, even if you consider them complete nonsense (like books of canon law derived from dogmatic theological principles), are extraordinarily useful to read if you care about understanding the progress of history, inclusive of why dogmatic patterns of thinking about particular subjects dominate at many period in time.

That said, I think everyone should at the very least have a basic knowledge of the Socratic dialogues, which are an excellent process in stimulating the mind and evaluating one's own presuppositions -- the approach of the majority of people is anything but the "examined life," and the only process of moving beyond the basic assumptions of a particular age is to examine them in the light of reason.

<<I want to start a startup, but I don't know how to program. How long will it take to learn?>>

Generally agree with pg, but I think the plethora of online learning aids means that it is better to learn the fundamentals on your own or in a week long course (i.e. how to build your first rails app), then "apprentice" yourself at a very low wage until you grasp the fundamentals. Also, I don't think this is a question merely of "smarts" but of an engineering/builder disposition, which some people simply don't have. I don't think "answering phones" is going to help you get that disposition.

This actually leads to a general critique of pg's "philosophy." Startups may be a very good solution to some problems, but are are certainly not a panacea for all problems. Ipso facto, it is important to more carefully define the problem scope and characteristics before defining the solution.</comment>


Ask HN: Did Google made a mistake by making Android free & open source?  - <AUTHOR>

Right now, Android is a success. Obviously, much of its success is attributed to the fact that it is free and open source. However, I'm not so sure whether it is a good long term strategy or not. I'm wondering what hacker news community thinks of this. Here are the pros and cons of current Android strategy:
Pros: 1. Free 2. Open source. 3. Low barrier to entry for any hardware manufacturer. 4. Support & evangelism by Google. 5. Google apps.
Cons: 1. Loss of "license fee" revenue. This can be huge, since it is projected that smartphones and Tablets are the future and millions of devices are getting activated every year. 2. Low barrier to entry for competing search providers (Yahoo, etc) & other web services providers (consider Facebook, Amazon). There have been rumors that Facebook is working to implement its own Android implementation and it could very well replace google search with Bing or facebook version of search. Amazon has already started its own Android Market and it already has a successful device (Kindle) under its belt. 3. Patent issues (law suits from Oracle, Microsoft and Apple). <comment><USER2> It seems fairly obvious to me that if Android wasn't free and open source, it wouldn't have grown big and there wouldn't have been much money in license fee revenue in the first place.

Same goes for stuff like Wikipedia and such. If it wasn't free, we wouldn't be talking about how big it is today, and the potential revenue would have been minimal.

<comment><USER3> Carriers besides AT&T were so desperate for _anything_ modern, they would have taken Android if it was $0 and "curated/opinionated" instead of open source. Google probably could have used licensing to lock out Bing, Sense, and other junk while ensuring that the ad revenue continues to flow.

</comment></comment><comment><USER4> I am pretty sure that Google's agenda was simply one of trying to ensure that the maximum number of mobile devices had unfettered access to the Internet - which is where they make their advertising dollars. If that meant building the new "windows" (but for mobile not desktop) then they are more than happy to pay the price.</comment>


We took a hacker to a public WiFi café (2014) - <AUTHOR> https://medium.com/matter/heres-why-public-wifi-is-a-public-health-hazard-dd5b8dcb55e6 <comment><USER2> > Many apps, programs, websites, and types of software make use of encryption > technologies. These are there to ensure that the information sent and > received from a device is not accessible to unauthorized eyes. But once the > user is connected to Slotboom's WiFi network, these security measures can be > circumvented relatively easily, with the help of decryption software

> We do the same for Facebook: Slotboom is able to intercept the login name > and password I entered with relative ease.

That sounds bit too good to be true. Facebook uses HSTS with preloaded certificates. I certainly am not aware of any "relatively easy" way of circumventing that.

> Everything, with very few exceptions, can be cracked.

Bit unnecessarily fatalistic attitude imho.

TLS is still pretty solid. Almost any half-decent VPN is non-trivial to crack. While software has holes, zero-days are typically bit beyond "All you need is 70 Euros, an average IQ" guys, so keeping your systems patched is effective measure.

Not saying that downgrade attacks etc aren't real threats, or that you don't need to pay any attention. But you can be relatively safe with fairly basic precautions and the overall situation is improving, one example being the increased alerts from browsers.

<comment><USER3> The article is from 2014 as indicated in the title. At the time HSTS was not as widespread.

HSTS bypass hacks also exist, which let the attacker controlling the DNS man- in-the-middle you through an insecure subdomain not in the HSTS preloaded list. I'm sure the guy has kept up to date with new developments to keep his job going :)

<comment><USER4> Do you have any more details around such an attack?

The only HSTS bypasses I am aware of that were possible with control over DNS were dependent on browser vulnerabilities that have been long since fixed or required the domain to not be cached or preloaded (which effectively means you'd only be able to attack first time visitors on sites that have not implemented preload who are clicking on an http link)

<comment><USER5> There was once even an easy to use software that shipped with an attack. It was called Firesheep and it let anyone skillful enough to install a browser extension get into the Facebook and Twitter sessions of anyone who shares the same network.

</comment></comment></comment></comment><comment><USER6> This is why Chrome is going to be marking all HTTP pages as "Not Secure" in v68+: [https://security.googleblog.com/2018/02/a-secure-web-is- here...](https://security.googleblog.com/2018/02/a-secure-web-is-here-to- stay.html)

<comment><USER7> Does not help against sniffing Probe Requests.

<comment><USER8> But sniffing probe requests doesn't get you much. You get a list of SSIDs they've seen, which could be potentially bad, but not nearly as bad as insecure sites not being marked as such.

<comment><USER7> Yes, but the article takes a focus on this too. But it's more useful for tracking people, for example in a large building.

</comment></comment></comment></comment><comment><USER9> Reading this, it sounds like a collection of different attacks on different mechanism up and down the stack is at play in this article. It'd be useful to know which ones, though I acknowledge that the article is probably not targeted towards an audience that would either want to know about or would understand the details of say, SSL stripping.

One thing that occurs to me is that the 1st stage of the attack described -- sniffing and spoofing probe requests -- could possibly be defeated, or at least made more difficult if the mobile wifi station authenticated the identity of the wifi base station before continuing with the rest of the auth/association sequence. Reading up on that sequence, I'm getting the impression that the mobile station doesn't do that, rather, it blindly trusts any base station with an ESSID and auth mechanism that match the one it's configured to connect to. If I'm right, that seems like a rather horrible oversight from a security perspective.

This leads me to another train of thought. The wifi standard is an IEEE one. The name, IEEE - Institute of Electrical and Electronics Engineers, suggests its constituents approach things from a perspective of "These are the known laws of physics. How do we dance within those rules to implement $goal in a cost-effective manner?" I don't see how the security implications of chosen implementation details would enter into design normally. This isn't a condemnation, just some observation and speculation. I similarly wouldn't expect an building architect to think about the security implications of an office's plumbing normally either unless I explicitly requested such.

As digital technology continues its seemingly inexorable march towards continued integration with our lives, I think it's well past time we start thinking more the security implications of our creations, and asking our peers to do the same.

</comment><comment><USER10> Some apps use encryption, which sounds great, but we have "decryption software"!

I understand that there are threats to badly implemented sites, and that even with well implemented sites you can snoop on which domains are being visited, and that there are 0days that some people are walking around with. But this seems like a pop tech piece that doesn't have things in proper perspective. I mean, it's probably good advice but for the wrong reasons.

</comment><comment><USER11> This extends beyond public wifis -- people put way too much trust in LANs. When I connect to a foreign LAN, I treat it as if I had connected straight to the internet.

<comment><USER12> People put too much trust in even their _home_ internet connections. A few weeks ago my home internet connection (Wave-G delivered via ethernet(dhcp) to my apartment) stopped working. I noticed instead of my router having its normal public ip, a 10/8 address had been assigned. After poking at the router address from the dhcp reply, I found myself looking at a Comcast cable modem.

Turned out a neighbor had moved in, and for whatever reason plugged the LAN side of a cable modem into the ethernet port on their wall, and had begun fighting the ISP's dhcp service.

<comment><USER13> Wait... your neighbor had an ethernet port in their apartment that was shared in your apartment? That's not a home network, that's more like a MAN (or Metro Ethernet or something). That ethernet port in your apartment should 100% be treated as hostile if that's the case.

<comment><USER12> The building has a shared ethernet fabric with a wireless uplink. With this configuration (and it isn't an uncommon configuration), anyone on the ethernet fabric can throw up a dhcp server and assign addresses/rutes to anyone else (or a number of other attacks).

DOCSIS has had similar issues in the past -- folks on the same node could directly pass frames between each other, and in some situations you could sniff your neighbors traffic.

My point was that whether you're at home or out and about, you shouldn't trust the "quality" of your internet connection, and should focus on having end to end encryption with whatever service you're attempting to communicate with.

</comment></comment></comment></comment><comment><USER14> Is always connected to a VPN a reasonable way to be secure?

<comment><USER12> An always connected VPN to _where_ exactly?

I struggle to find any "VPN Services" I trust not to sell every scrap of data they can harvest, let alone to actually secure their systems. They become relatively high value targets to anyone looking to collect data.

A VPN to your home only punts the issue to your ISP (see my other post on this topic for issues with that).

Connections across the internet desperately need to be secured end-to-end, whether they're coming from your home, cafe, or pub, and they need to be secured yesterday.

</comment></comment><comment><USER15> 2014\. WiFi connection snooping, MITM.

<comment><USER16> Thanks—year added to title above.

<comment><USER15> Originally posted HN title also read something along the lines of "wifi is bad for your health". Which is what made me look, at all. But no, it's not about (direct) physiological impact. Instead, your "data security" health. And from 2014; we've had 3 - 4 years for this to become much more mainstream knowledge.

</comment></comment></comment><comment><USER17> Would be nice to have this articled updated for 2018. The new title could read "We took a hacker to the same public WiFi Café" and see what has changed in the last 4 years. I'll bet not much.

</comment><comment><USER18> This has gotten a bit better since then with HSTS (and I didn't understand whether the attacker was doing SSL stripping, but it's also gotten a lot better against a passive attacker with much greater HTTPS adoption). But a significant fraction of these attacks would certainly still reveal sensitive information.

<comment><USER19> Some of the stuff in the article seemed a bit magical. He could tell that someone bookmarked a website?

<comment><USER20> He could tell she was browsing [https://del.icio.us/](https://del.icio.us/) and was able to find her account and see what she "bookmarked" there.

</comment></comment></comment><comment><USER21> Google is already trying to address this with the Android Wi-Fi Assistant. Wish Apple had something similar for iOS.

<comment><USER22> Do you have any more details?

<comment><USER21> [https://support.google.com/nexus/answer/6327199?hl=en](https://support.google.com/nexus/answer/6327199?hl=en) is the best Google-hosted link I could find after a quick search. The assistant establishes a VPN upon connecting to a public wifi network.

</comment></comment></comment><comment><USER23> > He asks me to go to Live.com (the Microsoft email site) and enter a random > username and password. A few seconds later, the information I just typed > appears on his screen.

This was interesting - how? Shouldn't only the hash of the PW be sent over the network?

<comment><USER18> Web applications normally receive the real password on each login, but only _store_ the hash in their long-term databases.

In this case the attacker might have also been doing SSL stripping, which (1) would typically work even if it were an HTTPS site, but not if it had HSTS or an HSTS preload; (2) would also allow him to change the site's user interface so that it asked for or received information in a different way from usual. So even if a site didn't normally solicit or transmit some specific kind of information, the tampered-with version might do so, assuming the attacker had thought to prepare a modified version of that particular site.

<comment><USER23> Thanks, I figured some MITM for the SSL piece but genuinely thought that client side JS hashed the PW. So this was educational and I am uncomfortably naive.

<comment><USER11> Once you start thinking in terms of using JS to hash the password it's very easy to end up reimplementing HTTPS in your own client code. Just a hash isn't going to do much because replay attacks, so you need additional measures in place.

Just running HTTPS is way preferable to implementing your own HTTPS in JavaScript.

But, of course, the larger problem is the password itself. No matter how you spin it with hashing or whatnot, a password is still a shared secret. You need to communicate a secret to the other party so they can verify it. You can almost hear how flawed a technology it is from the description, and I'm honestly surprised it has been allowed to exist for so long.

<comment><USER18> > No matter how you spin it with hashing or whatnot, a password is still a > shared secret. You need to communicate a secret to the other party so they > can verify it.

There are lots of challenge-response protocols that prove knowledge of a secret without communicating it. A simple example would be that the verifier could ask for the HMAC of the shared secret under a randomly-generated HMAC key. The prover can reply with the correct HMAC, but neither the verifier nor an eavesdropper would be able to reconstruct the shared secret from this reply without previously knowing the secret.

</comment></comment></comment></comment></comment><comment><USER24> old news, but Yet Another Reason To Always Use A VPN[tm].

<comment><USER25> Just not one provided by say, facebook [https://9to5mac.com/2018/02/13/facebook-protect-spyware- ios/](https://9to5mac.com/2018/02/13/facebook-protect-spyware-ios/)

<comment><USER24> /facepalm

/flipdesk

/startdrinking

</comment></comment></comment><comment><USER26> They have a slightly different definition of public health hazard than I'm used to.

<comment><USER16> That title probably counts as both misleading and linkbait, so in accordance with [https://news.ycombinator.com/newsguidelines.html](https://news.ycombinator.com/newsguidelines.html) we changed it to language from the subtitle.</comment></comment>


Typed Arrays in ECMAScript 6 - <AUTHOR> http://www.2ality.com/2015/09/typed-arrays.html

<comment><USER2> Typed Arrays are not the most exciting part of ECMAScript 6, but it is still good that they are part of the language now (vs. only a browser API). What surprised me while researching the post was how many browser APIs support Typed Arrays for binary data: File API, XMLHttpRequest, Fetch API, Canvas, WebSockets, WebGL, Web Audio API, and others.

(Disclaimer: I'm the author of the blog post.)

</comment><comment><USER3> Are typed arrays stored outside of the JS heap? For example, in node.js you can use Buffers to get around V8's 1.8GB JS heap limit -- are typed arrays similar? Does the ES6 spec specify whether typed arrays should be stored separately from the JS heap, or is that an implementation detail?

<comment><USER2> Yes, that is left unspecified in the spec:

* [http://www.ecma-international.org/ecma-262/6.0/#sec-allocate...](http://www.ecma-international.org/ecma-262/6.0/#sec-allocatearraybuffer) (relevant: step 4, CreateByteDataBlock())

</comment></comment><comment><USER4> I use typed arrays in Python when I need to store a lot of data in memory, and the overhead of objects would be too large (for example I built a little library that can load a country's worth of openstreetmap data).

What I really miss is typed dictionaries (int -> int).

<comment><USER2> I don't think there'll ever be typed dictionaries (which are a fairly high- level data structure). There is, however, a proposal for typed objects: [https://github.com/dslomov/typed-objects- es7](https://github.com/dslomov/typed-objects-es7)

<comment><USER4> Well, one could build a typed object-array library using typed arrays (i.e. use one typed array for every member). This actually gives me an idea... :P

But you wouldn't want to rebuild a dict using integer arrays, that would be pretty slow.</comment></comment></comment>


The Healthiest, Anti-Cancer Foods: G-Bombs (2017) - <AUTHOR> https://www.drfuhrman.com/elearning/eat-to-live-blog/62/the-healthiest-anti-cancer-foods-g-bombs <comment><USER2> Vegs and fruit make me depressed and paranoid. It's really bad. Anti-nutrients may be actually causing cancer. Overdosing on these fruits and vegs might be bad as well</comment>


Scout: Securely Locate Peers Without Central Servers - <AUTHOR> http://blog.bittorrent.com/2016/09/09/scout-securely-locate-peers-without-central-servers/ <comment><AUTHOR> Repository: [https://github.com/bittorrent/scout](https://github.com/bittorrent/scout)

</comment><comment><USER2> The Kademlia/Bittorrent DHT protocol still requires an initial node to bootstrap access the DHT. In Bittorrent, a set of known-good nodes is encoded into the .torrent file (or clients can use previously-discovered nodes they might happen to know about, or router.bittorrent.com as a last-resort fallback).

How does Scout bootstrap?

<comment><USER3> Scout uses BitTorrent Inc's bootstrap servers at router.bittorrent.com and router.utorrent.com.

<comment><USER4> In other words, nothing different than what we have now.

</comment></comment></comment><comment><USER5> Oh, I wonder if this means that Bittorrent Inc's own clients (e.g. uTorrent) are helping maintaining the DHT store by default now.

<comment><USER6> At least according to Wikipedia references, BitTorrent Inc's own client had mainline DHT support since version 4.2 (~2005). uTorrent seems to have added support for mainline DHT some time before the acquisition as well. There's a good torrentfreak post from the 10 year anniversary that covers the history pretty well: [https://torrentfreak.com/bittorrents-dht-turns-10-years- old-...](https://torrentfreak.com/bittorrents-dht-turns-10-years-old-150607/)

I'm guessing that your "by default now" may actually be in regards to BitComet and the v0.60 client that upset some folk?

Besides the BEP44 implementation magila mentioned, BitTorrent Inc. also assists with the DHT by operating a public bootstrap server at router.[bittorrent|utorrent].com, and provides the source too: [https://github.com/bittorrent/bootstrap- dht](https://github.com/bittorrent/bootstrap-dht)

<comment><USER7> What is the key difference between "central servers" and "bootstrap servers"?

I mean DHT is "decntralized" once the client has a copy, but initially a client has to get a copy of it from somehwere.

And unless every client gets the DHT from a different source, the system seems "centralized" in that sense.

<comment><USER5> Clients are allowed to store nodes received by the bootstrap servers and use them again at next startup, so the centralization is only on first run of the app.

</comment></comment></comment></comment><comment><USER8> IPFS should be looking at this. They had a number of NAT traversal issues this might help with.

<comment><USER9> IPFS dev here -- judging from a quick look, Scout uses NAT-PMP and UPnP for NAT traversal, so it basically has the same occasional NAT issues as everybody else in the P2P space. By the way, sometimes NAT issues are the fault of routers handed out by ISPs. The quality of these is often less than ideal.

(A pretty cool approach to circumventing NAT issues is a proper routed overlay network, which we plan to implement in libp2p soon: [https://github.com/ipfs/notes/issues/143](https://github.com/ipfs/notes/issues/143))

<comment><USER9> I should probably also mention that even if you implement the existing NAT traversal protocols correctly, these aren't satisfying solutions. We really need that damn time machine already, the End-to-End Principle should have been an End-to-End Law.

<comment><USER10> I'd love to see more effort to encourage laypeople to use and ask for IPv6. Imagine if instead of Microsoft and Sony inventing terms like "strict NAT" vs "open NAT" for how their gaming consoles describe network issues, they had those consoles inform their users that they can't host a game because their ISP doesn't provide IPv6 connectivity.

</comment></comment></comment></comment><comment><USER11> Can this be used to build a peer to peer VPN with no static IPs?</comment>


First glimpse of Kotlin 1.1: Coroutines, Type aliases and more - <AUTHOR> https://blog.jetbrains.com/kotlin/2016/07/first-glimpse-of-kotlin-1-1-coroutines-type-aliases-and-more/ <comment><USER2> Great stuff! Now I have absolutely no doubts, which would be my preferred JVM language!</comment>


Eta in Practice: Working with Haskell Packages - <AUTHOR> https://blog.eta-lang.org/eta-in-practice-working-with-haskell-packages-5dfa3dc0c98a <comment><USER2> Wow! This is awesome. This definitely motivates me to learn Eta.</comment>


A year of Rust and DNS - <AUTHOR> http://bluejekyll.github.io/blog/rust/dns/2016/08/21/a-year-of-rust-and-dns.html <comment><USER2> Love the idea of reimplementing DNS in Rust. Would love to see more efforts like this so that we have secure-by-design language implementation of core security services.

But BIND isn't just failing because "it's written in C", it's failing because it's written in terrible C. That said, "terrible C" is probably most every C routine written by someone with less than 10 years of _solid_ low level experience, so "writing good C code" is not very scalable. There _are_ active, solid projects with very few security exploits that are written entirely in C. Nginx comes to mind.

The article makes a brief reference to DJBDNS, which is written in C, but has suffered zero security exploits [1], and is extremely performant. And it _is_ being used in production, so presumably if it had any exploits they would have been exposed by now.

But...DJB's code is (usually?) released under a rather unfriendly (though mostly open) license, and DJBDNS hasn't been updated in some time, so a more modern project isn't a bad idea. And Rust developers can probably write solid code with only a few years of programming experience, which makes it easier to extend without adding security holes on a weekly basis (coughBINDcoughOPENSSLcough)...

[1] [http://cr.yp.to/djbdns/guarantee.html](http://cr.yp.to/djbdns/guarantee.html)

<comment><AUTHOR> > The article makes a brief reference to DJBDNS, which is written in C

About 14 years ago I worked on a project that was a fork of qmail. I got to know DJB's code quite well, to say the least it is awe-inspiring. The level of understanding and craftsmanship he has in C is honestly something I am certain I will never achieve. At the same time, it is some of (for me) the most dense and obtuse code I've had to read. I'm not a fan of loop unrolling, I think that's a thing for the compiler to optimize personally.

Anyway, in researching before starting this project, I was very aware of DJBDNS and all of the tools that make up that suite of tools. It is solid, like a rock. But like a rock, it is also inflexible. If you want to read an interesting post from DJB, this is excellent one on AXFR/IXFR: [http://cr.yp.to/djbdns/axfr-notes.html](http://cr.yp.to/djbdns/axfr- notes.html)

In reading this I realized that we have different goals for DNS. I want DNS to be flexible and secure, he clearly wants DNS to be secure and hardened. We have different goals, this is not to say my goals are better or worse, but I do think they differ fundamentally from that of DJB's.

You can't exploit something that you can't change.

<comment><USER3> You might find this interesting: "However, the closest in functionality and intent is Dan Bernstein's djbdns, which aims to be a minimalist, highly secure DNS server. The latest release of djbdns, including various support tools, is about 10,000 lines of C as measured by sloccount. We expect that it is possible to build a feature-par version with Nail that is an order of magnitude smaller and intend to do so."

[https://people.csail.mit.edu/nickolai/papers/bangert-nail- la...](https://people.csail.mit.edu/nickolai/papers/bangert-nail-langsec.pdf)

Nail, btw is parser written in the spirit of "language theoretic security", which is a poweful new way of looking at security problems.

</comment></comment></comment><comment><USER4> I don't know if you're aware of this or not, but when implementing standards with dozens of haphazard extensions, often the best way to keep track of all of the extensions is via the IANA assignments (see [http://www.iana.org/protocols](http://www.iana.org/protocols)). For DNS, the main page seems to be here: [http://www.iana.org/assignments/dns- parameters/dns-parameter...](http://www.iana.org/assignments/dns- parameters/dns-parameters.xhtml)

<comment><AUTHOR> Yes, I am very familiar with that page, but thanks for posting it! I've used it for double checking many of the record type assignments and the current sets of crypto graphic assignments.

</comment></comment><comment><USER5> An inspirational side-project.

> I want to get a DNS fuzzer running against it to really pound on it, and > then get some benchmark and comparison tests against other servers.

Even if the benchmarks turn out to be not in favor of Trust-DNS, the added safety overhead (if any) should be worth it.

> (I'll try to post more regularly on progress)

Please do. I thoroughly enjoyed the content as well as the writing style!

<comment><AUTHOR> >Please do. I thoroughly enjoyed the content as well as the writing style!

Thanks!

</comment></comment><comment><USER6> With Ironsides, that makes at least two of you using safest languages you can find to try to improve DNS. Good goal and tool to pick. :)

[http://ironsides.martincarlisle.com/](http://ironsides.martincarlisle.com/)

"Take a look at the full list sometime, I think roughly 50% of those could have been avoided by using (safe) Rust."

This is true for most vulnerabilities I see in C-related apps. We also know there's techniques to prevent that with acceptable performance. So, outside hobbyist or non-critical stuff, I tell people to use a different language to get the baseline of quality/security up. DNS is kind of example that makes it more true.

Now, I haven't learned Rust yet, so I won't be able to fully appreciate the article or spot coding ideas until I do. What I did spot was that you slogged through all the RFC's implementing and testing what you thought should be in the DNS system. Aside from a DNS server/client, I think one of most valuable things you could do in this project is create a _single_ specification of various things in DNS that cites parts of RFC's or advice from real-world implementations to justify each part. Kind of a walkthrough for other people creating DNS's that gives them high-level view and/or drill-down into details of something.

"While in the pit of dispair" "Then I climbed saviors peak"

Haha. Good job getting through all the work as most people quit that I can tell.

"It's currently not used in production (as far as I know). I've put a lot of work into validating correctness of what is going on"

It's good you have gone through the specs and have plenty of features. You did hit on a risk area that might need to be in this section: difference between the specs and real-world implementations that you _have_ to work with. The differences could cause your server to fail. If those exist in DNS, too, there might already be write-ups on common ones out there. Biggest way to find them, though, is running combo's of popular clients and servers against each other in testing. So, that's a possible consideration for the future.

<comment><AUTHOR> > With Ironsides, that makes at least two of you using safest languages you > can find to try to improve DNS

I looked at that a while ago, I should take another. Thanks for pointing that out.

> I think one of most valuable things you could do in this project is create a > single specification of various things in DNS that cites parts of RFC's or > advice from real-world implementations to justify each part. Kind of a > walkthrough for other people creating DNS's that gives them high-level view > and/or drill-down into details of something.

I was thinking of doing something like this, but you have an even better idea here. Actual references back to the code. I might start trying to do that. (Though that's probably as much work, if not more, as writing the software ;)

> Biggest way to find them, though, is running combo's of popular clients and > servers against each other in testing. So, that's a possible consideration > for the future.

Yeah, I've wanted to stand up some automated tests with the most popular systems out there, but there's a time issue here. If others are inspired and want to join the project, I'd love help in this area!

<comment><USER7> > I was thinking of doing something like this, but you have an even better > idea here. Actual references back to the code. I might start trying to do > that.

Literate programming (in the Knuth sense): yay!

> (Though that's probably as much work, if not more, as writing the software > ;)

Yep. Hence one of the few big projects I'm aware of that use lp (apart from Knuth) is:

Axiom:

[http://axiom.axiom-developer.org/axiom- website/books.html](http://axiom.axiom-developer.org/axiom-website/books.html)

Ed: from the post: > (And writing this post helped uncover a bug, so even if no one reads this, it was worth it).

Literate programming: yay!

Or perhaps narrative-driven design: ndd, to go with tdd and bdd...

</comment></comment></comment><comment><USER8> As a _ring_ [1] contributor, would be curious to hear if it could satisfy your crypto requirements. Using it could maybe help with your "(oh-my-dear-god I can not unsee what I saw in there, the C, not Rust)" experience.

[1] [https://github.com/briansmith/ring](https://github.com/briansmith/ring)

<comment><AUTHOR> Funny you should ask, I was just looking at that last week to try and answer that question.

I was also thinking of getting my feet wet in ring with some of the _easy_ issues on the github page.

<comment><USER8> Sounds awesome, looking forward to it!

If you are an IRC kind of person, maybe also consider joining the #rust-crypto channel on irc.mozilla.org.

</comment></comment></comment><comment><USER9> bluejekyll, have you thought about splitting the server into separate crates? (for example the parsing, the dnssec validation, the forwarding/resolving part, etc.) I'm planning to write a purely forwarding/reporting DNS server with white/black-lists and it looks like I could reuse 99% of code from you. But unless I'm missing something, the whole of the server is in one crate/repo. I did see that it's split into one lib and one bin, but haven't looked into how reusable that lib is yet.

<comment><AUTHOR> I have, and specifically for purposes like this. Honestly, it just hasn't been a high priority though.

At least for the client/server code, I think you'd end up with 90% of all the same dependencies, so I don't know exactly how I'd divide it up. If you have ideas, definitely let me know!

</comment></comment><comment><USER10> Great article.

>Implementing rfc1035 was deceivingly easy

This stuck out to me - RFC1035 is the first RFC I've read all the way through and had a shot at implementing. Then you realise it's RFCs all the way down and there's no easy way to navigate through all the overridden / deprecated parts.

<comment><USER11> Inded. The old RFCs are just the tip of the iceberg, and in the end you have to pretty much ask "What would BIND do?".

Zone master files are a great example of this. There's no official grammar and so there are subtle differences in the way different DNS servers parse them.

Its also easy to under-estimate and not notice for example, until you've written a lexer or two, that the grammar is context sensitive and ambiguous... so I'd almost guarantee that trust-dns can be made to interpret one differently to BIND, Knot, or unbound.

</comment></comment><comment><USER12> Just curious. Is this the normal way:

        let recursion_available = (0b1000_0000 & r_z_ad_cd_rcod) == 0b1000_0000

That just seems redundant. If you declared the var as a Boolean, would the == 0bxxxx part have been necessary?

<comment><USER13> If r_z_ad_cd_rcod is of type u8, then 0b1000_0000 & r_z_ad_cd_rcod is also of type u8, containing the value 0 or 128. It is (by design) not possible to simply cast a number to a bool in Rust; comparing it with some value is the way you are required to do this. You can do this with `== 0b1000_0000` if you want, or `!= 0` would do just as well.

Rust is deliberately explicit about conversions between types; it's less error-prone, though often more verbose. It's a part of the language's philosophy.

<comment><USER14> This seems like a good use case for a bit mask query function. I see Rust has a bitflags crate:

[https://doc.rust-lang.org/bitflags/bitflags/index.html](https://doc.rust- lang.org/bitflags/bitflags/index.html)

<comment><AUTHOR> I found that after I had already written a lot of that code. I haven't had much reason to go back and change it, but any PR's if someone wants to do it, would be accepted.

<comment><USER15> What about simply replacing all "== 0b..." with "!= 0"?

That would already be a good improvement, both in terms of DRY and readability, without the need of adding another dependency.

<comment><USER16> It wouldn't be the same thing. For instance x & 0b11 != 0 can return true for multiple values of x, 0b10 and 0b01 respectively.

<comment><USER15> I see. You are sometimes checking for multiple bits at once. Didn't notice that.

</comment></comment></comment></comment></comment></comment></comment><comment><USER17> See also BIND 10: [https://ripe68.ripe.net/presentations/208-The_Decline_and_Fa...](https://ripe68.ripe.net/presentations/208-The_Decline_and_Fall_of_BIND_10.pdf)

</comment><comment><USER18> Nit: Rust doesn't prevent memory leak.

<comment><USER19> It is unfortunate you're downvoted for making a true statement. It's extremely important that people don't see Rust as a panacea.

<comment><USER20> Fortunately it appears this perfectly legitimate comment has been salvaged. Steve, I was disappointed that this topic[1] received no discussion at all at HN. Has anyone inside Mozilla looked at it? The title is a bit click-baity for academic work, in my opinion, but I do think the points raised are worthy. Much like recent criticism of PostgreSQL by Uber, one hopes the purveyors of Rust are also open and respond well to constructive criticism.

1\. [https://news.ycombinator.com/item?id=12258957](https://news.ycombinator.com/item?id=12258957)

<comment><USER19> It wasn't discussed a lot because it's quite old, and we talked about it a lot when it was published. I actually met (and then became friends with) Amit in real life because of this paper; we're both in New York and got coffee to discuss it.

(It's been a while, but IIRC the issues they had were more about not understanding what exacty was available and how to use them, at the time. The project has been going really well since then; Amit has been giving a number of cool talks about it at various Rust user groups, and they recently started their own "This week in", though it's called "Talking Tock" because that's a better name, ha!)

</comment></comment></comment></comment><comment><USER21> with erlang you can parse the dns-header like so:

,----

| %% extract dns-header fields from a raw packet.

| parse_dns_header(raw_packet) ->

| <<

| ID:16,

| QR:1, OPCODE:4, AA:1, TC:1, RD:1, RA:1, Z:3, RCODE:4,

| QDCOUNT:16,

| ANCOUNT:16,

| NSCOUNT:16, ARCOUNT:16,

| Tail/binary

| >> = raw_packet,

|

| {#dns_header_record {

| id = ID,

| qr = QR, opcode = OPCODE, aa = AA, tc = TC, rd = RD, ra = RA, z = Z, rcode = RCODE,

| qdcount = QDCOUNT,

| ancount = ANCOUNT,

| nscount = NSCOUNT,

| arcount = ARCOUNT

| }, Tail}.

|

`----

almost verbatim 'transliteration' of sec:4.1.1 of 1035 :)

<comment><USER22> FWIW you can get code-formatting by prefixing lines with a 4-space indent:

        parse_dns_header(raw_packet) ->
          <<
              ID:16,
              QR:1, OPCODE:4, AA:1, TC:1, RD:1, RA:1, Z:3, RCODE:4,
              QDCOUNT:16,
              ANCOUNT:16,
              NSCOUNT:16, ARCOUNT:16,
              Tail/binary
          >> = raw_packet,

Also for readers, this does depend on customisable (per-segment/field) defaults: `ID:16` is a shorthand for `ID:16/big-unsigned-integer-unit:1` aka "16-bits wide segment parsed as an unsigned integer in big endian"

<comment><USER21> > FWIW you can get code-formatting by prefixing lines with a 4-space indent

ah thank you ! that is very good to know.

will it be possible to have some formatting guidelines / examples on the site somewhere ? similar to what we see on reddit ?

<comment><USER22> > will it be possible to have some formatting guidelines / examples on the > site somewhere ?

[https://news.ycombinator.com/formatdoc](https://news.ycombinator.com/formatdoc)

Sadly HN has jack shit formatting-wise (the most annoying part being you can't escape asterisks so half the time it's going to emphasise a comment section and remove your asterisks despite that not being what you wanted)

<comment><USER21> > Sadly HN has jack shit formatting-wise

it _is_ 'spartan' :)

<comment><USER22> I'd be fine with spartan (only support for code blocks) or more featureful (escapes at least), but as things are it's less spartan and more annoyingly half-assed.

</comment></comment></comment></comment></comment></comment><comment><USER23> Great post, great library. I used it in a CloudFlare dynamic dns client I wrote to play around with Rust. I'm still very new to Rust so these sorts of post are really helpful. Thank you bluejekyll!

</comment><comment><USER24> Another DNS-related project in Rust: EdgeDNS [https://github.com/jedisct1/edgedns](https://github.com/jedisct1/edgedns)

</comment><comment><USER25> Any benchmarks against the MirageOS TCP/IP stack?

It would be interesting to see how the way Rust manages memory and its current optimizer match against OCaml in a production TCP/IP stack.

<comment><AUTHOR> I'd love to get some benchmarks going. It's not as high a priority for me right now as getting to feature complete (my definition of that anyway).

The question you pose though is awkward. MirageOS is a unikernel, Trust-DNS is an application, a consumer of the TCP stack.

I have seen Rust apps built into rumprun, but as of right now this isn't something on my list, in theory it's possible.

<comment><USER25> It is not awkward at all.

You can build a DNS server with MirageOS and it is used like that in the context to the new Docker versions for Mac OS X and Windows, which is one example of being used in production.

</comment></comment></comment><comment><USER26> The only technical comment I have is that it continues to be amazing to me that destructuring binary data is so stupidly verbose in so many languages. I think C and Erlang are the only two languages that got this right.

<comment><USER22> Erlang I can easily see (destructuring binary data in erlang is an absolute pleasure) but C? Most binary destructuring in C seems to be done with shifts and masks, there's some gain from implicit integral conversions but I don't remember it being "right". IIRC the memory layout of bitfields is not specified so you can't use them to portably destructure binary streams, only to define "packed" structures for memory saving.

<comment><USER27> > IIRC the memory layout of bitfields is not specified so you can't use them > to portably destructure binary streams, only to define "packed" structures > for memory saving.

This is correct as my colleagues have recently relearned. Moving from one endianness to another seriously complicated their lives for a few weeks (time to initial discovery of error, time to add in new definitions, time to test the updated system).

</comment></comment></comment><comment><USER28> Would love to repeat this sometime using pure modern C++.

<comment><USER29> It would be really interesting to have a set of extremely similar programs in, let's say, "matured C", modern C++ and Rust for comparison purposes.

<comment><USER28> Yeah. That would be really nice as these languages are competing for the same ground. Go beats all in ease of programming but something is not quite satisfying with it(my personal opinion). I really like having control of my memory. But that doesn't matter usually for most of the application processes.

</comment></comment></comment><comment><USER30> much more fun to write in scala: [https://github.com/MasseGuillaume/Scala- DNS/tree/master/src/...](https://github.com/MasseGuillaume/Scala- DNS/tree/master/src/main/scala/dns)

</comment><comment><USER31> Isn't trying to write a secure implementation of DNS as it is today, like adding a chain to your door? Mostly for show?

<comment><USER32> Security of DNS the protocol (and the way it's deployed) is different from not exposing the computer running your DNS server to attacks. This is trying to solve the latter, which seems like a good idea.</comment></comment>