Fork me on GitHub
#crypto2016-08-29
>
lvh16:08:25

yay, this channel now exists for a reason

xcthulhu16:08:44

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

lvh16:08:52

so much crypto

lvh16:08:01

and macros named

xcthulhu16:08:12

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

lvh16:08:04

do you care about running in browsers or something?

lvh16:08:54

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

xcthulhu16:08:28

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.

lvh16:08:17

But you still need to trust your server, right

xcthulhu16:08:46

Eh, not really.

xcthulhu16:08:59

You have to trust content delivery

xcthulhu16:08:29

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

xcthulhu16:08:03

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

lvh16:08:11

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

lvh16:08:17

or trust your server rather

lvh16:08:55

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

lvh16:08:59

but no guarantees when that happens

lvh16:08:07

also potentially JS-but-ffi

lvh16:08:09

for node

lvh16:08:54

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

lvh16:08:04

It would seem that you could generate nilpotent sequences of operations

lvh16:08:24

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

lvh16:08:25

stuff like that

xcthulhu16:08:37

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...

lvh16:08:38

that might be easier than manual verification because your test stays

xcthulhu16:08:14

But it's not safe for other reasons.

lvh16:08:14

makes sense

lvh16:08:50

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 🙂

xcthulhu16:08:17

I'm pretty crazy about enforcing that everywhere, actually

xcthulhu16:08:15

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

lvh16:08:34

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

xcthulhu16:08:05

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

lvh16:08:28

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

lvh16:08:36

OK, so signing some data

lvh16:08:42

first off; why do you care about canonicalization?

lvh16:08:54

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

xcthulhu17:08:47

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 ...]}

lvh17:08:47

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

xcthulhu17:08:28

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

lvh17:08:22

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

lvh17:08:31

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

lvh17:08:28

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

lvh17:08:28

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

lvh17:08:50

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

xcthulhu17:08:14

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

lvh17:08:23

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

xcthulhu17:08:24

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

lvh17:08:14

I don’t understand the implication

lvh17:08:21

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

xcthulhu17:08:22

Well, does clojurescript even have array-maps?

lvh17:08:12

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

lvh17:08:28

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

lvh17:08:58

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

xcthulhu17:08:47

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

lvh17:08:04

Does transit let you pick compressors?

xcthulhu17:08:41

Not in ClojureScript, no...

xcthulhu17:08:23

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

xcthulhu17:08:10

@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

xcthulhu17:08:25

Gary is the man for trying to fix this mess