Skip to content

Instantly share code, notes, and snippets.

View Bitcoin'sPoW.py
import hashlib
import time
# text = "Bitcoin mining uses the SHA256 hashing algorithm"
# text_hash = hashlib.sha256(text.encode('utf-8')).hexdigest()
# print(text_hash)
# def findNonce(text):
# for nonce in range(20):
View GetBitcoinWalletUTXOs.py
import requests
import json
address = input('Paste Wallet Address: ')
response = requests.get(f'https://blockchain.info/unspent?active={address}')
# utxo list
utxo_list = json.loads(response.text)["unspent_outputs"]
View BitcoinWalletFromPrivateKey.py
import codecs
import ecdsa
import secrets
import hashlib
# generate bitcoin private key
def generate_private_key():
bits = secrets.randbits(256)
bits_hex = hex(bits)
return bits_hex[2:]
View EllipticCryptographyMaths.py
Pcurve = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 -1 # The proven prime
N=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 # Number of points in the field
Acurve = 0; Bcurve = 7 # This defines the curve. y^2 = x^3 + Acurve * x + Bcurve
Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240
Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424
GPoint = (Gx,Gy) # This is our generator point. Tillions of dif ones possible
#Individual Transaction/Personal Information
privKey = 75263518707598184987916378021939673586055614731957507592904438851787542395619 #replace with any private key
RandNum = 28695618543805844332113829720373285210420739438570883203839696518176414791234 #replace with a truly random number
@lumunge
lumunge / Kaleidoscope_Compiler.cpp
Last active Apr 30, 2022
A compiler for the Kaleidoscope programming language - full tutorial(https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/LangImpl01.html)
View Kaleidoscope_Compiler.cpp
#include<iostream>
#include<string>
#include<memory>
#include<vector>
#include<map>
using std::vector;
using std::unique_ptr;
using std::map;
@lumunge
lumunge / allOne.cpp
Created Nov 1, 2021
Designing a Data Structure that returns the string occurring maximum and minimum times.
View allOne.cpp
#include<iostream>
#include<unordered_map>
#include<list>
using std::unordered_map;
using std::string;
using std::list;
using std::pair;
using std::cout;
using std::endl;
@lumunge
lumunge / reversePartLinkedList.cpp
Created Oct 31, 2021
Reversing part of a linked list
View reversePartLinkedList.cpp
#include<bits/stdc++.h>
struct ListNode{
int data;
ListNode *next;
};
class LinkedListReversal{
private:
//reverse a linked list
@lumunge
lumunge / deleteNthNodeFromEnd.cpp
Created Oct 30, 2021
Code from Remove N-th Node from end of Singly Linked List post on opengenus
View deleteNthNodeFromEnd.cpp
#include<bits/stdc++.h>
//linked list structure
struct ListNode{
int data;
ListNode *next;
};
class LinkedListDeletion{
public: