crypto

2016-08-29T16:43:12.000003Z

@lvh Here

lvh 2016-08-29T16:43:25.000004Z

yay, this channel now exists for a reason

lvh 2016-08-29T16:43:25.000005Z

hi

2016-08-29T16:43:44.000006Z

It's nice to meet another person doing crypto with Clojure/ClojureScript

lvh 2016-08-29T16:43:52.000007Z

so much crypto

lvh 2016-08-29T16:44:01.000008Z

and macros named

2016-08-29T16:44:12.000009Z

So it's been a massive effort to do ECC in ClojureScript

lvh 2016-08-29T16:44:45.000010Z

uhuh

lvh 2016-08-29T16:45:04.000011Z

do you care about running in browsers or something?

lvh 2016-08-29T16:45:54.000012Z

(also, how did you acquire that code? emscripten?)

2016-08-29T16:46:28.000013Z

Yeah, I want my app to be somewhat decentralized. Users should be able to sign their state and pass it to a third party for processing without necessarily going through my server.

lvh 2016-08-29T16:47:17.000014Z

But you still need to trust your server, right

2016-08-29T16:47:46.000015Z

Eh, not really.

2016-08-29T16:47:59.000016Z

You have to trust content delivery

2016-08-29T16:48:29.000017Z

I'd do content delivery via IPFS if I could, but maybe in 2019 or something

2016-08-29T16:50:03.000018Z

But I'd love it if someone else wanted to use the library I've been working on.

lvh 2016-08-29T16:50:11.000019Z

Sure; that’s what I meant by “trust my server” 🙂

lvh 2016-08-29T16:50:17.000020Z

or trust your server rather

lvh 2016-08-29T16:50:41.000022Z

anyway; so I do https://github.com/lvh/caesium

lvh 2016-08-29T16:50:55.000024Z

I’d like to make that work with libsodium.js in pure JavaScript at some point

lvh 2016-08-29T16:50:59.000025Z

but no guarantees when that happens

lvh 2016-08-29T16:51:07.000026Z

also potentially JS-but-ffi

lvh 2016-08-29T16:51:09.000027Z

for node

lvh 2016-08-29T16:51:54.000028Z

I wonder if you could reasonably test the property you care about (determinism) with test.check

lvh 2016-08-29T16:52:04.000029Z

It would seem that you could generate nilpotent sequences of operations

lvh 2016-08-29T16:52:24.000030Z

I dunno: see an array, copy it; see a map; split it in two and then merge the result

lvh 2016-08-29T16:52:25.000031Z

stuff like that

2016-08-29T16:52:37.000032Z

This is cool. Yeah, another reason to go with secp256k1 is that BitCoin already has a proper JNI interface to their library for that curve, which uses GMP to avoid timing attacks...

lvh 2016-08-29T16:52:38.000033Z

that might be easier than manual verification because your test stays

2016-08-29T16:53:14.000034Z

But it's not safe for other reasons.

lvh 2016-08-29T16:53:14.000035Z

makes sense

lvh 2016-08-29T16:53:50.000036Z

apropos: my “ECC for programmers” talk that I do (mostly internally) ends with breaking a secp256k1 impl that doesn’t check if points are on the curve correctly 🙂

2016-08-29T16:54:17.000037Z

I'm pretty crazy about enforcing that everywhere, actually

2016-08-29T16:56:15.000038Z

Anyway, so what do you do if you want to sign {:foo "bar", 123 {:baz 'symbol}}?

lvh 2016-08-29T16:56:34.000039Z

yeah; sorry; for clarity; that wasn’t a criticism of any software you wrote, just why I don’t like secp256k1

2016-08-29T16:57:05.000040Z

Ah, I don't like it because it's not a safe curve - https://safecurves.cr.yp.to/

lvh 2016-08-29T16:57:28.000041Z

that is one of the reasons it’s not a safe curve 🙂

lvh 2016-08-29T16:58:02.000042Z

(The attack I mentioned is on https://safecurves.cr.yp.to/twist.html)

2016-08-29T16:58:18.000043Z

ok

lvh 2016-08-29T16:58:36.000044Z

OK, so signing some data

lvh 2016-08-29T16:58:42.000045Z

first off; why do you care about canonicalization?

lvh 2016-08-29T16:58:54.000046Z

(I’m not saying that canonicalization is bad; just interested)

2016-08-29T17:00:47.000047Z

I want the client to be able to sign updates to their data when they make a delta, like {:old-hash [245 0 10 ...], :delta <...>, :new-hash [123 23 0 ...]}

lvh 2016-08-29T17:01:47.000049Z

Without them necessarily remembering the hashes; so they can remember what they incidentally sent, rather than what they must have sent?

2016-08-29T17:02:28.000050Z

Well, it's so a third party can reconstruct their transaction history

lvh 2016-08-29T17:02:50.000051Z

aha

lvh 2016-08-29T17:03:22.000052Z

in my case, txns are signed; so I can just go use the actual signature as a reference; I don’t necessarily care about it being reconstitutable from just the data

lvh 2016-08-29T17:03:31.000053Z

i.e. I validate txns before using them for anything anyway

lvh 2016-08-29T17:04:28.000054Z

(I dunno if it helps, but I’m using https://github.com/ptaoussanis/nippy)

lvh 2016-08-29T17:05:28.000056Z

I will file a ticket to see if peter has thought about this problem at all

lvh 2016-08-29T17:05:50.000057Z

test.check might already have something in its ecosystem to produce equal-but-different data structure

lvh 2016-08-29T17:05:51.000058Z

s

2016-08-29T17:06:14.000059Z

Yeah, it's worth digging in test.check...

lvh 2016-08-29T17:06:23.000060Z

I guess you probably care about hash-map vs array-map?

2016-08-29T17:07:24.000061Z

Not really, because I have to deal with stuff being in either Clojure or ClojureScript.

lvh 2016-08-29T17:08:14.000062Z

I don’t understand the implication

lvh 2016-08-29T17:08:21.000063Z

Oh, wait, maybe I do; just poor choice of words on my part

2016-08-29T17:08:22.000064Z

Well, does clojurescript even have array-maps?

lvh 2016-08-29T17:09:12.000065Z

You want (= a b) to imply (= (freeze a) (freeze b))

lvh 2016-08-29T17:09:28.000066Z

I’m trying to find a way to define that property cross-runtimely

lvh 2016-08-29T17:09:58.000067Z

I guess nippy is not relevant to you then because it’s Clojure-only 🙂

2016-08-29T17:11:47.000068Z

Yeah, I probably just need to do the silly canonical transformation thing. I probably could have something that doesn't load the stack up too high with clojure.walk

lvh 2016-08-29T17:17:04.000069Z

Does transit let you pick compressors?

2016-08-29T17:28:41.000070Z

Not in ClojureScript, no...

2016-08-29T17:33:23.000072Z

@lvh Since I'm hashing and flinging deltas around, compression isn't such a big deal...

2016-08-29T17:36:10.000073Z

@lvh One thing that sucks is that ClojureScript falls back on goog.math.Integers when deserializing java.math.BigIntegers, but they aren't actually usable because mulitiplication is broken for them - https://github.com/google/closure-library/pull/741

2016-08-29T17:36:25.000075Z

Gary is the man for trying to fix this mess