Skip to content

Instantly share code, notes, and snippets.

def convert_base(num, to_base=10, from_base=10):
# first convert to decimal number
if isinstance(num, str):
n = int(num, from_base)
else:
n = int(num)
# now convert decimal to 'to_base' base
alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
if n < to_base:
return alphabet[n]
@uvicorn
uvicorn / Cargo.toml
Last active February 2, 2024 17:43
Add fields\functions to struct && add implementations of functions in the implementation of a trait by a structure
[package]
name = "libmacro"
version = "0.1.0"
edition = "2018"
publish = false
[lib]
proc-macro = true
[dependencies]
@uvicorn
uvicorn / f.md
Created August 5, 2023 13:08
Writeup - crypto- pekobot AIS3 Pre-Exam 2022

Абоба

Оригинальный репозиторий: https://github.com/Electron-Labs/ed25519-circom

Сплойт: https://github.com/uvicorn/ed25519-circom-bug/tree/main/exploit

Range check

Почитав всякие аудиты я заметил, что львиная доля уязвимостей на circom - это integer overflow, который получают из-за неправильной проверки, что число находится в промежутке [a; b] (например https://github.com/0xPARC/zk-bug-tracker/tree/main#1-dark-forest-v03-missing-bit-length-check ).

Реализация в данной библиотеке: