Skip to content

Instantly share code, notes, and snippets.

@tarassh
tarassh / mta_protocol.py
Created August 4, 2025 18:04
Multiplicative-to-Additive Conversion (MtA)
#!/usr/bin/env python3
"""
Multiplication-to-Addition (MtA) Protocol Implementation
This implements a secure two-party protocol that converts multiplication into addition.
The protocol allows two parties with private inputs a and b to compute additive shares
s1 and s2 such that s1 + s2 = a * b mod q, without revealing their inputs to each other.
The MtA protocol is a fundamental building block in multi-party computation (MPC) systems,
enabling secure multiplication operations in protocols like ECDSA threshold signatures.
@tarassh
tarassh / ecc_utils.py
Last active July 13, 2025 20:14
Oblivious Transfer
#!/usr/bin/env python3
"""
P-256 Elliptic Curve Cryptography Utilities
This module provides a centralized implementation of P-256 elliptic curve
operations, constants, and utilities used across the MPC protocol implementations.
It eliminates code duplication and provides a consistent interface for all
ECC-related operations.
This module includes:
#include "h264_ssim64x64_from_prover.h"
typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;
typedef long int int64_t;
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long int uint64_t;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
contract NFT1155 is ERC1155Burnable {
/**
*
* @dev `uri_` tokens base URI pattern.

Keybase proof

I hereby claim:

  • I am tarassh on github.
  • I am tarassh (https://keybase.io/tarassh) on keybase.
  • I have a public key ASAUP055vSurhZGB0vOF6B6UNoeO1sxrHNesFVwmD8ZeLQo

To claim this, I am signing this object:

pragma solidity ^0.4.23;
contract RandomVote {
event ParticipantIndex(address indexed participant, uint indexed index, uint indexed stepsToNextRound);
event ParticipantNumber(address indexed participants, uint indexed number, uint indexed stepsToChoosingTheWinner);
event TheWinner(address indexed participant, uint indexed number);
address public winner;
@tarassh
tarassh / node_cfg.rs
Created January 8, 2018 10:33
exonum configurations for validator and auditor node.
pub fn node_config() -> (NodeConfig, NodeConfig) {
let (validator_consensus_public_key, validator_consensus_secret_key) = exonum::crypto::gen_keypair();
let (validator_service_public_key, validator_service_secret_key) = exonum::crypto::gen_keypair();
let (auditor_consensus_public_key, auditor_consensus_secret_key) = exonum::crypto::gen_keypair();
let (auditor_service_public_key, auditor_service_secret_key) = exonum::crypto::gen_keypair();
let validator_keys = ValidatorKeys {
consensus_key: validator_consensus_public_key,
service_key: validator_service_public_key,
};