Skip to content

Instantly share code, notes, and snippets.

View vinarmani's full-sized avatar

Vin Armani vinarmani

View GitHub Profile
@vinarmani
vinarmani / gist:0d57c91ff638b7526e991eaf7fb45974
Last active December 29, 2023 13:19
Generate Ethereum and Bitcoin addresses using the number 1 as a private key
import * as secp from '@noble/secp256k1'
import ripemd160 from 'ripemd160-js/ripemd160.mjs'
import * as sha3 from 'js-sha3'
import { createHash } from 'node:crypto'
import { binary_to_base58 } from 'base58-js'
// Generate public key for private key of number 1 (or any number between 1 and ~10^77)
const privateKey = Buffer.alloc(32)
privateKey.writeUInt8(0x1, 31)
@vinarmani
vinarmani / bitcoindrm.js
Last active April 14, 2022 23:42
Quick and dirty DRM for JPEGs leveraging ECIES (encryption and decryption) with Bitcoin private and public keys - Node.js
const fs = require('fs');
const eccryptoJS = require('eccrypto-js');
const coinkey = require('coinkey');
const convertToEncryptStruct = (encbuf) => {
let offset = 0;
let tagLength = 32;
let pub;
switch(encbuf[0]) {
case 4:
@vinarmani
vinarmani / padres_marlins_jeton_contract
Created July 17, 2019 21:01
Contract Creation for Padres vs Marlins (Steven vs. Vin) July 17, 2019
const jeton = require('jeton-lib')
const PrivateKey = jeton.PrivateKey
const PublicKey = jeton.PublicKey
const Signature = jeton.Signature
const OutputScript = jeton.escrow.OutputScript
const Transaction = jeton.Transaction
// Create the output script
var refpk = new PublicKey("029ba4d2d14a5c24e4b7b6aa953ecf24b599e2f5e944412a9d60e5878f0f6a06cd")