Skip to content

Instantly share code, notes, and snippets.

View sander's full-sized avatar

Sander Dijkhuis sander

View GitHub Profile
@sander
sander / ChoosingBasePointsWithECDSA.java
Created April 22, 2023 14:54
Choosing base points with ECDSA
import org.bouncycastle.jce.ECNamedCurveTable;
import org.bouncycastle.jce.interfaces.ECPublicKey;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.jce.spec.ECParameterSpec;
import org.bouncycastle.jce.spec.ECPublicKeySpec;
import org.bouncycastle.math.ec.ECPoint;
import java.security.*;
import java.util.Base64;
@sander
sander / zkp.rs
Last active November 13, 2022 20:42
Schnorr Non-interactive Zero-Knowledge Proof in Rust
//! Unevaluated prototype of IETF RFC 8235 §3.3 with §4.
// [dependencies]
// elliptic-curve = "0.12.3"
// p256 = "0.11.1"
// sha2 = "0.10.6"
use std::cmp::min;
use std::ops::{Add, Mul};
@sander
sander / ZeroKnowledgeProof.java
Last active October 26, 2022 20:13
Schnorr Non-interactive Zero-Knowledge Proof in Java
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.bouncycastle:bcprov-jdk18on:1.72
import org.bouncycastle.crypto.digests.SHA256Digest;
import org.bouncycastle.jce.ECNamedCurveTable;
import org.bouncycastle.jce.spec.ECParameterSpec;
import org.bouncycastle.math.ec.ECPoint;
import java.math.BigInteger;
@sander
sander / listhash.scala
Created October 17, 2022 08:20
Cross-encoding list hashing inspired by objecthash
package listhash
enum Expr:
case Atom(value: Array[Byte] | String | Symbol) extends Expr
case Comp(value: List[Expr]) extends Expr
opaque type ListHash = Array[Byte]
/** Inspired by https://github.com/benlaurie/objecthash */
def listHash: Expr => ListHash =
import scala.util.matching.Regex
val in = """# Systems
|
|## System 1
|
|- Foo: bar
|- Baz: qux
|- Bla:
| 1. Bla
@sander
sander / model.js
Last active October 25, 2020 14:30
Event-driven architecture prototyping in vanilla JavaScript
/**
* The following is a prototype to demonstrate how enterprise integration can be modelled using
* vanilla JavaScript. This could benefit service design: low-fidelity modelling of bounded contexts
* and messages makes ideas more tangible to explore and communicate. The model can be run inside
* an HTML page and tested using:
*
* dispatchEvent(new Event("test"));
*
* In this script I will refer to the following design domain concepts.
*/
@sander
sander / agenda.json
Last active May 13, 2018 10:58
Agenda
{
"updated": "2018-05-13T10:54:07.829Z",
"events": [
{
"url": "https://pop-in-expo.hetnieuweinstituut.nl/activiteiten/gear",
"suptitle": "Tentoonstelling",
"title": "Gear Up",
"description": "Gear Up toont speculatieve ontwerpen vanuit een activistisch uitgangspunt. Alle werken zijn ontwikkeld door studenten van de opleiding Interaction Design tijdens een lesmodule Information Superiority gegeven door Arif Kornweitz.",
"start": "2018-04-10T09:00:00.000Z",
"end": "2018-05-13T15:00:00.000Z",

Keybase proof

I hereby claim:

  • I am sander on github.
  • I am sq (https://keybase.io/sq) on keybase.
  • I have a public key ASD_8jMfWgcTbtdt0PbqfxsZdG_-ZnkuHGhIRIhwGtjqmwo

To claim this, I am signing this object:

@sander
sander / _error
Created August 17, 2016 10:13
Problem deploying ring-1.6.0-beta5 uberwar with async in jetty9
clojure.lang.ArityException: Wrong number of args (1) passed to: core/handler
at clojure.lang.AFn.throwArity(AFn.java:429)
at clojure.lang.AFn.invoke(AFn.java:32)
at clojure.lang.Var.invoke(Var.java:379)
at lein_ring_test.listener$_contextInitialized$fn__11.invoke(listener.clj:1)
at ring.util.servlet$make_service_method$fn__85.invoke(servlet.clj:129)
at lein_ring_test.servlet$_service.invokeStatic(servlet.clj:1)
at lein_ring_test.servlet$_service.invoke(servlet.clj:1)
at lein_ring_test.servlet.service(Unknown Source)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:837)
@sander
sander / _log-curl
Last active August 8, 2016 13:58
ring 1.6.0-beta4 issue
$ curl -vvv http://localhost:3000/
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 3000 (#0)
> GET / HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Mon, 08 Aug 2016 13:50:07 GMT