News for hackers. Stuff that matters.

modalduality

Re:Kotlin: The Problem with null on Friday January 12, 2018 @09:21PM (#16137901)
Most languages with monads have tools for working with them. In Haskell, for example, even without `liftM2` or `sequenceM`, you can simply do

    case (xm, ym) of
        (Just x, Just y) -> x + y
        _ -> 0
About ten of us are playing in https://modalduality.org/sibylant-graze/play/lobby if you'd like to join!

A bit about the technical stack: the server was written in Haskell using WebSockets. Source at https://git.modalduality.org/sibylant-graze/tree/.

Re:NIST Post-Quantum Cryptography Round 1 Submissions on Wednesday December 27, 2017 @12:11PM (#16016128)
In general forward security involves generating a new key for each conversation with Diffie-Hellman or similar.

According to https://crypto.stackexchange.com/questions/5610/diffie-hellm..., Diffie-Hellman is not post-quantum secure, but https://en.wikipedia.org/wiki/Supersingular_isogeny_key_exch... is a DH alternative that is.

The main idea is to explore the concept of skinny triangles being unaesthetic (and thus undesirable for triangulations). This is true for many tasks in computational geometry, but not so true in art. Bringing these two together shows jarring conflict where the Delaunay Triangulation and your brain's sense of aesthetics disagree.

It's not really supposed to be useful, just exploration in reduction of an already reduced art style: what is lost when we enforce that all shapes are triangles that tend to be more large-angle? For one, I think this destroys the perspective since one common trope is to make objects narrower as they are farther away.

Although the entire thing is mostly a joke based on their shared last names.

Ah, so Aaronson is talking about the Busy beaver shifts function of 2 there. I gave the answer to the busy beaver function counting the maximum number of 1s.
> What makes it okay to identify the naming of a large number with producing that large number of things (e.g. 1's)?

Nice catch! I glossed over this but this is pretty important. The issue is that for any _specific number_, it takes a constant amount of time to write a number larger than that. Related: solving chess is technically O(1) since there are a constant number of positions we have to check.

What we need instead for this concept is a series of numbers, those can be compared with the question "Does one eventually get to a point where it will always be larger than the second?". We can parametrize the "biggest number" by the number of seconds given, say we can write down one character per second. Then a person's largest number function might be something like "f(n) = 9 ^ n", which is easy to see _is_ a computable function, and thus smaller than BB(n) for the same number of seconds, eventually.

In practice, just something like BB(100) - or BB(BB(100)), even can't really be written out by any computable method in a finite amount of time.

> which was: what characterizes the Busy Beaver function?

The proper one is just the number of 1s, but I talked about the shift function because it's easier to see why it's uncomputable. Tibor Rado proved that the Busy beaver function is also uncomputable in his 1962 paper, if you're interested you could check out his reduction.

In case you think you've figured out the 2-state solution and you want to check that you can't do better, I've uploaded the number of 1s your machine should output at https://modalduality.org/static/busy-beaver-2.txt, but did not include the actual configuration.
Re:4Clojure Easy Problems Updated on Clojurecademy on Sunday October 29, 2017 @07:29PM (#15582159)
In addition to 4Clojure, I found the Brave Clojure book (https://www.braveclojure.com/) helpful for understanding how to structure programs in a "Clojure-y" way, e.g., to a greater extent than OOP representing data in lists and maps instead of structured classes, or using the "nil" value effectively when chaining functions together, almost like the Maybe monad.
Is it easy to write timing-attack-resistant crypto code in Clojure? Sounds interesting, what company was this for? Thinking of implementing Damgard-Jurik myself sometime.
Re:Crypto for kids on Wednesday September 06, 2017 @01:00AM (#15181343)
yup! they should have used a commitment scheme instead - for example, SHA256(winning numbers || 512-bit nonce). To reveal, reveal the winning numbers and the nonce and Mr X can check that the hash matches. The nonce is to introduce more entropy so Mr X can't just bruteforce the hash, but since finding any collision is difficult, it doesn't let the alien cheat by trying different nonces (unlike with different keys with encryption schemes).
Re:Restic Cryptography on Wednesday August 30, 2017 @03:07PM (#15134975)
Does anyone know why they might choose to encrypt-then-MAC vs. an AEAD scheme? Seems less error prone.
Re:Rust for the Web on Monday August 14, 2017 @10:11PM (#15014784)
Web developers may be also interested in https://gotham.rs/, which was released very recently and looks to be a promising competitor to Rocket.
Re:A Solution of the P versus NP Problem? on Monday August 14, 2017 @08:05PM (#15014197)
P = NP implies the polynomial hierarchy collapses, thus P = Sigma2, so by contradiction P != NP.
Re:Learn Regex the Easy Way on Thursday August 10, 2017 @09:39AM (#14979480)
Wow, how did you find that commit?
Re:Learn Regex the Easy Way on Thursday August 10, 2017 @03:27AM (#14977245)
Good article (didn't realize there were other kinds of lookaround), but maybe the bottom should link to well-tested standards-based regexes instead.

    URL: ^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$
I recently encountered a case where a URL had an underscore at the end of a subdomain name. It seems underscores are okay anywhere else, but while my friend on Windows was able to load the website, I wasn't (on Linux) using Firefox, curl, remote screenshot service which presumably ran Linux etc. According to various RFCs, they should be okay anywhere within the subdomain name.

Has anyone encountered this behavior? Couldn't find anything on the internet; maybe it's just my computer?

Re:Timing attacks and usernames (2012) on Tuesday August 08, 2017 @03:49PM (#14961790)
As the author mentions, this solution doesn't create identical distributions between the found case and the not-found case.

One other concern is that a db hit and miss could take very different amount of times (e.g., L1 hit vs miss that travels to disk).

* Don't waste server time hashing a password if you already know the user doesn't exist.

doesn't seem like too big of a concern, since you're spending the time anyway, it's just increasing server load marginally.

To solve the first problem, how about running two queries in parallel against the db, one for a fixed username and one for the given username? However, depending on the database, now you may run into caching issues with the fixed username, speeding up that query. Querying for a random username at the beginning might also push that row into the cache.

Maybe keep a large, randomized linkedlist of usernames on-disk (initialized on server startup), read out the next link, and use that as parallel username?

For these ideas I believe you would need to enforce a max-password-length and take up that many steps to check equality for all passwords.

Re:TFHE: Fast Fully-Homomorphic Encryption Over the Torus on Monday August 07, 2017 @01:21PM (#14949214)
In general it's much easier to reason about Boolean circuits because they always have an answer, unlike arbitrary programs that may never halt, for example, so you see a lot of theoretic results focusing on Boolean circuits (sometimes with limitations on the depth) instead.

Early on it was thought that considering circuits instead of regular programs could result in "polynomial with advice" algorithms for NP-complete problems, but results such as the Karp-Lipton theorem have shown this to be unlikely.

Does anyone know what the proof actually proves, and how the reduction was formulated?
Re:Rust: Not So Great For Codec Implementing on Tuesday August 01, 2017 @12:41PM (#14902632)
My bad, I meant profiling, not benchmarking.
Re:Rust: Not So Great For Codec Implementing on Tuesday August 01, 2017 @11:40AM (#14901885)
Not a Rust expert, but some thoughts on the negatives.

> Compilation time is too large

Can you try compiling incrementally? https://blog.rust-lang.org/2016/09/08/incremental.html. Might still only be on nightly.

> And, on the similar note, benchmarks.

I agree, profiling as well isn't as full featured as in more mature languages. Clojure, incidentally has great benchmarking due to being on the JVM.

> Also the tuple assignments.

Can't you just do

    fn main() {
        let (a, b) = (5, 2);
        println!("{}, {}", b, a);
    }
>There are many cases where compiler could do the stuff automatically.

I think this will be solved with the new non-lexical lifetimes RFC. Also a problem I had when starting, I generally assume referential transparency.

Re:Firefox Roadmap for Flash End-Of-Life on Wednesday July 26, 2017 @09:40AM (#14856084)
.newsbeuter/config has a "browser" command where you can give arbitrary a shell command where %u is the URL, you could give it your own script that matches on the URL.

For example, mine is 'browser "urxvt -e elinks %u"'.

Re:How to create a private Ethereum network on Tuesday July 25, 2017 @07:34PM (#14852757)
One common use is to test out your new contract code without using real ethereum. You could even imagine a time where you could run a fuzzer on your contract to try to find bugs.

Personally I don't think there's a real risk of exposing your real Ethereum wallet by setting up a testnet, as long as you only let localhost connect to it.

Re:How to create a private Ethereum network on Tuesday July 25, 2017 @06:59PM (#14852579)
Good article. I found while doing the same thing a lot of the information online was out of date (for example referencing geth's built-in solc) and unusable.

One addition--Geth 1.6 released a very nice interactive tool called puppeth that creates genesis blocks and provisions testnets, I've found it easier than doing everything myself.

Although once again there really wasn't any tutorial or documentation about puppeth for Ethereum beginners, the only reference I could find was a Taiwanese Ethereum meetup blogpost, which was mostly in Chinese.

Re:Using Hilbert Curves to 100% Zelda on Sunday July 23, 2017 @01:52AM (#14831058)
That's fine, but `p` is a variable, not a constant, in the original post's case, right?
Re:Using Hilbert Curves to 100% Zelda on Sunday July 23, 2017 @12:03AM (#14830849)
Right, but then the problem is no longer linear and approximating is more difficult. I'm not exactly sure what you mean by "exponential weight" in a linear program, do you have an example?

Older ยป