Skip to content

Instantly share code, notes, and snippets.

marekyggdrasil /
Last active April 3, 2024 13:59
Playing with AGE (actually good encryption) to try some test vectors from ツ.

This repository contains my simplified AGE (Actually Good Encryption) heavily based on pyage library.

It's purpose is to demonstrate the fact that GRIN core wallet implementation is producing incorrect HMAC signatures in its AGE-encrypted payloads.

  1. contains values implementated by the GRIN core wallet. My code correctly decrypts it only if HMAC verification is ignored. Decrypted payload contains the sender address.
  2. contains official AGE test vector. My code correctly decrypts it and verifies the HMAC and matches the expected file key. Decrypted payload hash matches the expected value.

Another indicator the GRIN core wallet is producing flawed HMAC signatures is the fact that in grin++ wallet the HMAC verification also had to be commented out.

To run it, first setup

marekyggdrasil /
Created March 13, 2024 09:10
Computing the bong-bing-bang-and-gong number for
def numberToBase(n, b):
if n == 0:
return [0]
digits = []
while n:
digits.append(int(n % b))
n //= b
return digits[::-1]
marekyggdrasil /
Last active December 5, 2022 21:38
MINA zkApp that allows deposits and withdrawals

A very simple zkApp that allows user to deposit and withdraw. Run it with

node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads node_modules/jest/bin/jest.js -- fakemac.test.ts
marekyggdrasil /
Created August 18, 2022 12:42
how to use class decorators with arguments in Python
from functools import wraps
class ForbiddenDrink:
def __init__(self, drinks):
self.do_not_drink_that = drinks
def __call__(self, func):
def wrapper(*args, **kwargs):
innerself = args[0]
marekyggdrasil /
Last active June 23, 2022 16:19
A proposal for ツ GRIN tipping Telegram bot

GRIN Tipping Bot Bounty Proposal

by renzokuken


This document aims to technically define the requirements for a Telegram bot that can deposit and withdraw GRIN digital cash cryptocurrency. It is meant to be regarded as a formal application for a bounty suggested in this forum post.

Use cases

Such a bot could serve more than one purpose.

marekyggdrasil /
Last active February 21, 2022 14:42
I found this problem with serialization / deserialization of objects of type CircuitValue in snarky-js when arrayProp is involved, not sure if it is correct or not....

Running the version without arrayProp

[nodemon] starting `node --no-warnings --experimental-specifier-resolution=node --loader ts-node/esm try_circuit_serialization.ts`

* checking if JSONized objects match after parsing

{ a: '1', b: { value: '1' } }
{ a: '1', b: { value: '1' } }
marekyggdrasil /
Last active January 17, 2022 04:21
weird MINA issue with keypair generation, attempting to develop a test for preimage proof

Runs and passes, but if I uncomment line 27 it fails with


      at Object.mM [as caml_pasta_fp_plonk_index_create] (node_modules/snarkyjs/dist/server/node_bindings/snarky_js_node.bc.js:2:23985)

marekyggdrasil /
Last active December 20, 2022 15:33
Example code for the tutorial on Pedersen Commitments and Confidential Transactions available under
convert -background none inputs_before.png inputs_after.png +append inputs.png
marekyggdrasil /
Last active September 13, 2021 09:52
Source code and results for the Schnorr signature tutorial available under
convert -background none multisignature_alice.png multisignature_bob.png multisignature_composite.png +append multisignature_keys.png
convert -background none multisignature_nonces.png multisignature_lhs_signatures.png multisignature_rhs_signatures.png +append multisignature_verification.png
marekyggdrasil /
Last active April 24, 2021 10:36
Examples for tutorial on symmetric ciphers available under
from Crypto.Cipher import AES
from getpass import getpass
ciphertext = None
with open('ciphertext3.txt', 'r') as file:
ciphertext = bytes.fromhex(
password = getpass('Password: ')
key = bytes(password, 'ascii')
key = key + b'\x00'*(16-len(key))