Skip to content

Instantly share code, notes, and snippets.

View xhliu's full-sized avatar

xhliu xhliu

View GitHub Profile
@0xjac
0xjac / private_fork.md
Last active March 28, 2024 03:24
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@RobinLinus
RobinLinus / bitcoin-txs.md
Created June 8, 2023 21:50
Raw Bitcoin transactions hand-parsed for educational purposes

Raw Bitcoin Transactions

P2PK

https://blockstream.info/block/00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee

Raw

https://blockstream.info/tx/f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16

0100000001c997a5e56e104102fa209c6a852dd90660a20b2d9c352423edce25857fcd3704000000004847304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901ffffffff0200ca9a3b00000000434104ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84cac00286bee0000000043410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac00000000

Parsed

@artjomb
artjomb / PairingLibs.md
Last active March 26, 2024 06:14
List of Pairing Libraries

Pairings can be used for all kinds of advanced cryptographic schemes such as Encryption (Identity-based, Attribute-based, Predicate-based, etc.), Signatures, Zero-Knowledge Proofs, etc. It is in no particular order.

Provides multiple types of Elliptic Curve groups with appropriate pairings on top of them. Code repository resides here.

License: LGPL
Language: C
Thesis: On the Implementation of Pairing-Based Cryptography by Ben Lynn (2007)

@gitaarik
gitaarik / git_submodules.md
Last active March 25, 2024 12:47
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@zhangweis
zhangweis / token.scrypt
Last active March 9, 2024 08:42
Add current merkle root to records and allow signature only on record. This can better support cold key storage.
import "util.scrypt";
contract Token {
public function transfer(bytes txPreimage, bytes fromRecord, bytes fromMerklePath, Sig senderSig,
bytes toRecord, bytes toMerklePath, bytes insertPoint, bytes insertPointMerklePath,
int amount, int utxoAmount) {
require(amount>0);
require(utxoAmount>=0);
// this ensures the preimage is for the current tx
require(Tx.checkPreimage(txPreimage));
@msinkec
msinkec / steg_latex.md
Last active March 1, 2024 11:16
Embedding a Secret Message in a PDF through LaTeX

This gist outlines a method to embed a secret message within a LaTeX document through the use of variable length spaces, ultimately rendered in a PDF. This technique is a form of steganography, allowing information to be hidden in plain sight, with the secret message being undetectable to casual observation.

Generating the LaTeX File with a Secret Message

The first step involves creating a Python script that processes a given text (the content of the LaTeX file) and a secret message. This script converts the secret message into a binary string, where each bit (0 or 1) corresponds to a specific spacing in the LaTeX document. The spaces are not uniform; 0 might correspond to a smaller space, while 1 corresponds to a larger space. This variation in spacing is subtle and typically unnoticed by readers, but it can be used to encode binary data.

Below is a simplified version of the Python script that generates a LaTeX file embedding a secret message:

content = '''Your document content goes here...'''
@dino-
dino- / string-conversions.hs
Last active February 17, 2024 19:27
A handy illustration of converting between String, Text and ByteString in Haskell
#! /usr/bin/env stack
-- stack --resolver lts-18.8 script
{-# LANGUAGE OverloadedStrings #-}
{-
This is a handy illustration of converting between five of the commonly-used
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy
Text).
/**
* Ethereum Account Scanner
*
* To run this, you need your own geth node, accepting RPC
* connections on a port you can access.
*
* Install pre-requisites:
* sudo npm install -g web3
*
* Usage:
@chriseth
chriseth / snarktest.solidity
Last active December 3, 2023 07:03
zkSNARKs test code
// This file is MIT Licensed.
//
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF O
@ryboe
ryboe / .travis.yml
Last active November 23, 2023 05:37
Example .travis.yml for Golang
# use the latest ubuntu environment (18.04) available on travis
dist: bionic
language: go
# You don't need to test on very old versions of the Go compiler. It's the user's
# responsibility to keep their compiler up to date.
go:
- 1.16.x