News for hackers. Stuff that matters.

xcthulhu

Well, a couple months back I attended a talk on a Haskell implementation of the Noise protocol.

The programmer admitted that he was a cryptography novice, and in fact a Haskell novice.

As a result the code he wrote is needlessly abstract - for one thing the guy uses Free monads and in turn ropes in template Haskell as part of his state model. I really have no idea what code he's generating.

The code has other features that make review challenging - for instance he doesn't qualify any of his imports so it's hard to tell where to look for the functions he's implementing.

Maybe you are better at auditing Haskell than I am. As DJ Bernstein writes in various places, one common exploit is to construct an elliptic curve Diffie Helman shared secret with input that isn't a curve point. I really can't tell if the guy is mitigating against this attack or not, but here you can have a look:

https://github.com/centromere/cacophony

> Why do we do this, still? Is it not irresponsible?

One reason is security - if cryptography isn't done in constant time then there is the potential for timing attacks. This is why BitCoinJ ditched BouncyCastle for their own JNI wrapper around BitCoin's libsecp256k1.

There is a rust client for Ethereum, called Parity - they do FFI calls to libsecp256k1. Similarly rust-crypto vendors most of its crypto in C that it calls through FFI. Similarly go-ethereum also uses libsecp256k1. However, I know that Tendermint uses Ed25519 instead of secp256k1, and in turn they use NaCl which does not involve FFI.

Mining for Ethereum is done on a GPU, so the miner code is necessarily written in OpenCL or CUDA.

There are a few blockchains written in functional language but they are new to the scene. There were a couple of Haskell Ethereum clients but they appear to be abandoned. I know kadena[1] and cardano[2] are written in Haskell. There is also Aeternity[3], which is the only currency I know of written in Erlang.

In the early days Charles Hoskinson apparently wanted Ethereum to be written in Scala. I don't think any of the core devs know Scala, but then again Charles Hoskinson was booted from the project so his language choice was dropped.

Synereo was to be written in Scala, but the founders (the CEO and the CTO) split in December. The CEO doesn't want Synereo to make a blockchain anymore, he wants to make some kind of escrow for ponzi schemes. I hear from the devs they want to code the thing in javascript. The CTO is making something called RChain; I heard he wants to use some pi-calculus interpreter he wrote in C90 back when he worked at Miter corporation in the 90s, but maybe he's ditching that.

From job postings I can see MaidSafe is looking for Rust programmers. MaidSafe has been in R&D for a decade, so they must have had yet another pivot recently.

To be frank, while there are functional programmers in the scene, these guys are struggling to establish themselves. There's a lot more talent in procedural programming which is why so much code is written in those languages. I'm not 100% that functional code is going to have fewer bugs which result in financial exploits.

[1] http://kadena.io/ [2] https://iohk.io/projects/cardano/ [3] https://github.com/aeternity

Re:Neural Networks, Manifolds, and Topology on Wednesday April 09, 2014 @09:18AM (#7559053)
The Universal Approximation Theorem[1] asserts that you only ever need one hidden layer, which at least asserts that "an (approximate) simplification exists".

But I can't say off the top of my head how you'd collapse an ANN just two hidden layers into 1. It's not obvious how sigmoid functions compose, but I suppose I should give it more thought...

---------- 1: http://en.wikipedia.org/wiki/Universal_approximation_theorem

Re:How Class-based Programming Sucks (2011) on Friday December 13, 2013 @09:14AM (#6900526)
Okay, for one:

1. Dynamically Typed Languages (LISP, Erlang, Smalltalk, Python, Ruby, and Javascript) are all easier than Haskell, JAVA, C++ or any other typed language for working with ADTs. Whether the language is OO or not isn't really relevant. On the other hand, you loose type-safety/efficient representations. But life is filled with choices, different tools are good for different things at different times.

2. You can have closures in a class based language. Here's some rather exotic Python code that uses both for measuring the performance of iterators: https://github.com/wearpants/measure_it/blob/master/measure_...

Smalltalk and Scala also have closures. It's not an either/or for classes vs. closures in programming language land.

3. There's more to concurrency than shared memory, so immutability is again a weapon that is good for some battles. If you have an app which you've factored into workers, unless they are on the same machine they'll need to communicate. Having your data be serializable is more important than having things be immutable in this context. What a worker does with data while it is handling it can involve lots of mutation.

So everyone should take a big breath, and remember that there's no one way to think about software and there's no universal rules, other than probably P != NP and stuff like that.

Re:A Crash Course in the Mathematics Of Infinite Sets on Tuesday December 03, 2013 @09:01AM (#6840246)
Poincaré was a genius but math has moved forward since the 19th century.

Here's what I'd argue is the most important take away from set theory: for a given framework of mathematics, there are conjectures one can make that can be neither proved nor disproved. Perhaps the most high-profile of them is the continuum hypothesis.

Maybe P!=NP is such a conjecture. Maybe the existence of a solution to the Navier-Stokes equation is such a problem. For Poincaré, the very idea that there is math that can be neither proved nor disproved was not in his mental vocabulary.

On another note, Weil's celebrated proof of Fermat's last theorem relies on the existence of inaccessible cardinals[1], although I've heard it conjectured that they are not necessary.

[1] https://en.wikipedia.org/wiki/Inaccessible_cardinal

Re:Meet Bill Gates, the Man Who Changed Open Source Software on Monday January 30, 2012 @08:45AM (#3528715)
Isn't Microsoft's schizophrenic relationship with FOSS old news? The same company that claims "Linux is a cancer" also employs K.Y. Srinivasan, a topic linux kernel contributor [1], and Simon Peyton Jones of Haskell fame.

Microsoft's competitors Apple and Google have dealt with OSS much more gracefully. While I don't approve of this approach, these companies 'embraced' open source with projects like Darwin and Android OS, and then twisted the efforts in proprietary directions. I don't know if this strategy was ever really available to Microsoft, however.

[1] http://lwn.net/Articles/451243/

Re:Stephan Wolfram: 100 Years Since Principia Mathematica on Friday November 26, 2010 @03:45PM (#1943254)
> Bernard Linsky seems to have written a chapter on Chwistek and type theory in The Golden Age of Polish Philosophy. You can read the first page [3] but I haven't been able to find the entire thing online.

Try gigapedia.com ;-D

Re:Stephan Wolfram: 100 Years Since Principia Mathematica on Friday November 26, 2010 @02:21PM (#1943042)
>No one uses ramified type theory these days, at least not that I am aware

In the 1920s Frank Ramsey proved that the theory of ramified types + "The Axiom of Reducibility" is equivalent to the theory of simple types: http://en.wikipedia.org/wiki/Type_theory#Simple_theory_of_ty...

The history I've heard is that ramified types were abandoned after this, since simple type theory is easier and has the same expressive power.

Re:Stephan Wolfram: 100 Years Since Principia Mathematica on Friday November 26, 2010 @02:08PM (#1943010)
Check out the axioms of Peano Arithmetic: http://en.wikipedia.org/wiki/Peano_axioms#Arithmetic

If we use Dedekind's recursive definition of addition, and the definitions 1=S(0) and 2=S(S(0)), then:

S(0) + S(0) = S(S(0)+0) = S(S(0))

I know the computer proof assistant Isabelle/HOL, inspired by the Principia Mathematica, can prove simple theorems about arithmetic using a "rewrite" system similar to what I've done above.