Skip to content

Instantly share code, notes, and snippets.


Henry de Valence hdevalence

View GitHub Profile
hdevalence /
Last active Apr 26, 2021
clone repos from an organization into current directory
curl -s "" | jq '.[].clone_url' | xargs -L1 git clone
View gist:659c53b2286522eb38a1cdc86eb9d0f5
"annotations": {
"list": [
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
View Non-canonically-encoded Ed25519 points
encoding edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f has order 4
encoding edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff has order 4
encoding eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f has order 1
encoding eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff has order 1
encoding f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f has order 8p
encoding f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff has order 8p
encoding f1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f has order 8p
encoding f1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff has order 8p
encoding f2ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f has order 8p
encoding f2ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff has order 8p
View gist:93ed42d17ecab8e42138b213812c8cc7
TestCase {
vk_bytes: "0100000000000000000000000000000000000000000000000000000000000000",
sig_bytes: "01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
valid_legacy: false,
valid_zip215: true,
TestCase {
vk_bytes: "0100000000000000000000000000000000000000000000000000000000000000",
sig_bytes: "c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a0000000000000000000000000000000000000000000000000000000000000000",
hdevalence /
Created Mar 25, 2020
Anonymous Retrospective Broadcasts
  • Anonymous Retrospective Broadcasts
    • If we don't assume a centralized party that can be trusted to verify information, what we're left with is not really a contact tracing application but a particular kind of messaging application, where users create tracks through space and time, and can retrospectively broadcast anonymous messages to users whose tracks were spatially nearby to theirs in a particular time range.
    • This messaging system should be privacy-preserving, in the sense that:
      • Server Privacy: An honest-but-curious server should not learn information about any user's space-time tracks;
      • Locality Integrity: A user should not be able to broadcast messages to users who were not nearby to them;
      • User Privacy:
        • A passive adversary cannot not learn any information about a user's space-time track outside of the segments they have broadcast messages to. This means that users who do not broadcast reveal no information about their movements.
hdevalence / gist:30ce0674ce1b7d27221a975d9d2b6ef9
Created Mar 11, 2020
for i in (seq 0 756600); ./src/zcash-cli getblock $i | jq -c '[.version, .height]' | grep -v '\[4,' ; end;
View gist:30ce0674ce1b7d27221a975d9d2b6ef9
hdevalence / Bulletproofs Transcript Example
Created Jan 10, 2019
Log of a Merlin transcript for a 64-bit Bulletproof
View Bulletproofs Transcript Example
Initialize STROBE-128(4d65726c696e2076312e30) # b"Merlin v1.0"
meta-AD : 646f6d2d736570 || LE32(24) # b"dom-sep"
AD : 4167677265676174656452616e676550726f6f6654657374 # b"AggregatedRangeProofTest"
meta-AD : 646f6d2d736570 || LE32(13) # b"dom-sep"
AD : 72616e676570726f6f66207631 # b"rangeproof v1"
meta-AD : 6e || LE32(8) # b"n"
AD : 4000000000000000 # b"@"
meta-AD : 6d || LE32(8) # b"m"
AD : 0100000000000000 # b""
meta-AD : 56 || LE32(32) # b"V"
hdevalence /
Last active Aug 24, 2018
example of zkp-expanded dleq with merlin
create_nipk!{dleq, (x), (A, B, G, H) : A = (G * x), B = (H * x) }
mod dleq {
use curve25519_dalek::ristretto::RistrettoPoint;
use curve25519_dalek::scalar::Scalar;
use curve25519_dalek::traits::{MultiscalarMul, VartimeMultiscalarMul};
use merlin::Transcript;
use rand::thread_rng;
use std::iter;
impl<'a, 'b> Add<&'b CachedPoint> for &'a ExtendedPoint {
type Output = ExtendedPoint;
fn add(self, other: &'b CachedPoint) -> ExtendedPoint {
// The coefficients of an `ExtendedPoint` are reduced after
// every operation. If the `CachedPoint` was negated, its
// coefficients grow by one bit. So on input, `self` is
// bounded with `b < 0.007` and `other` is bounded with
// `b < 1.0`.
let mut tmp = self.0;
View gist:d118f270ac1177fd0c357640433ab8aa
git clone
cd curve25519-dalek
git checkout 0.18.0
echo "nightly-2018-06-19" > rust-toolchain
export RUSTFLAGS="-C target_cpu=znver1"
cargo bench --features "nightly u64_backend" "aA+bB"
cargo bench --features "nightly avx2_backend" "aA+bB"