Skip to content

Instantly share code, notes, and snippets.

@marekyggdrasil
marekyggdrasil / README.md
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) http://age-encryption.org/v1 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. slateage.py 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. validage.py 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
marekyggdrasil / mcm.py
Created March 13, 2024 09:10
Computing the bong-bing-bang-and-gong number for https://x.com/botnetzprovider/status/1767680709726978051?s=20
def numberToBase(n, b):
if n == 0:
return [0]
digits = []
while n:
digits.append(int(n % b))
n //= b
return digits[::-1]
@marekyggdrasil
marekyggdrasil / README.md
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
marekyggdrasil / example.pl
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):
@wraps(func)
def wrapper(*args, **kwargs):
innerself = args[0]
@marekyggdrasil
marekyggdrasil / README.md
Last active June 23, 2022 16:19
A proposal for ツ GRIN tipping Telegram bot

GRIN Tipping Bot Bounty Proposal

by renzokuken

Introduction

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
marekyggdrasil / output.md
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
marekyggdrasil / README.md
Last active January 17, 2022 04:21
weird MINA issue with keypair generation, attempting to develop a test for preimage proof https://github.com/o1-labs/snarkyjs-examples/blob/master/src/ex00_preimage.ts

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

 console.log
    oo

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

  console.log
 eyo
@marekyggdrasil
marekyggdrasil / figures_thumbnail.sh
Last active December 20, 2022 15:33
Example code for the tutorial on Pedersen Commitments and Confidential Transactions available under https://mareknarozniak.com/2021/06/22/ct/
#!/bin/sh
convert -background none inputs_before.png inputs_after.png +append inputs.png
@marekyggdrasil
marekyggdrasil / figures_thumbnail.sh
Last active September 13, 2021 09:52
Source code and results for the Schnorr signature tutorial available under https://mareknarozniak.com/2021/05/25/schnorr-signature/
#!/bin/sh
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
marekyggdrasil / aes.py
Last active April 24, 2021 10:36
Examples for tutorial on symmetric ciphers available under https://mareknarozniak.com/2021/04/22/symmetric/
from Crypto.Cipher import AES
from getpass import getpass
ciphertext = None
with open('ciphertext3.txt', 'r') as file:
ciphertext = bytes.fromhex(file.read())
password = getpass('Password: ')
key = bytes(password, 'ascii')
key = key + b'\x00'*(16-len(key))