Skip to content

Instantly share code, notes, and snippets.

View odudex's full-sized avatar

Odudex odudex

View GitHub Profile
@odudex
odudex / nostr_seed.py
Last active May 10, 2024 09:43
Uses Embit to convert hex or bech32 keys to BIP39 seed words and vice-versa
"""Uses Embit and qrcode modules to convert hex and bech32 keys to BIP39 seed words and vice-versa.
Also generates ascii compact seed QR codes.
Install Embit:
pip install embit
Exemple: Words as input:
python nostr_c_seed_qr.py picture body actor coil end satoshi fish mom distance proof thank play fantasy friend dinner clump boring ozone review cart virtual toss foot infant
Hex Key: a4431c0a96a4997ed5ec763fb58b7f532530b9cf916219f3d2e2118f47cb56bb
Bech32 key: nsec153p3cz5k5jvha40vwclmtzml2vjnpww0j93pnu7juggc737t26ascxcmgr
BIP39 seed numbers: [1315, 200, 22, 363, 589, 1532, 702, 1143, 510, 1379, 1791, 1331, 665, 744, 499, 355, 208, 1269, 1477, 281, 1956, 1838, 728, 923]
@odudex
odudex / dice.py
Last active December 26, 2022 11:24
Compare your devices dice generated seed with the ones generated by this script and check how each word and checksum were calculated
"""Compare your devices dice seed creation with the ones generated by this script
and check how each word and checksum were calculated.
Ex:
python dice.py 565256126243114366655152522264552364231641333461455456111566561236253463223236163643465622462251536
Entropy bytes: b'565256126243114366655152522264552364231641333461455456111566561236253463223236163643465622462251536'
Hashed bytes: 2e364baddcfa80dfc910fc92b634e962d2f844e9e9a210428d8e4d899a6883ae
Hashed bits: 0b10111000110110010010111010110111011100111110101000000011011111110010010001000011111100100100101011011000110100111010010110001011010010111110000100010011101001111010011010001000010000010000101000110110001110010011011000100110011010011010001000001110101110
@odudex
odudex / nostr_seed_trezor.py
Last active March 21, 2024 16:16
Uses Trezor python-mnemonic to convert hex keys to BIP39 seed words and vice-versa
"""Uses Trezor python-mnemonic to convert hex keys to BIP39 seed words and vice-versa
Install Trezor python-mnemonic:
pip install mnemonic
Exemple: Convert hex key to words:
python nostr_seed_trezor.py a4431c0a96a4997ed5ec763fb58b7f532530b9cf916219f3d2e2118f47cb56bb
Seed words: picture body actor coil end satoshi fish mom distance proof thank play fantasy friend dinner clump boring ozone review cart virtual toss foot infant
BIP39 seed numbers: [1315, 200, 22, 363, 589, 1532, 702, 1143, 510, 1379, 1791, 1331, 665, 744, 499, 355, 208, 1269, 1477, 281, 1956, 1838, 728, 923]
Exemple: Convert words to hex key:
@odudex
odudex / nostr_c_seed_qr.py
Last active February 21, 2023 19:57
Uses Embit and qrcode modules to generate ascii compact seed QR codes from nostr keys.
"""Uses Embit and qrcode modules to convert hex and bech32 keys to BIP39 seed words and vice-versa.
Also generates ascii compact seed QR codes and public keys.
Install Embit:
pip install embit
Exemple: Words as input:
python nostr_c_seed_qr.py picture body actor coil end satoshi fish mom distance proof thank play fantasy friend dinner clump boring ozone review cart virtual toss foot infant
Exemple: Hex key as input:
@odudex
odudex / air_nostr.py
Last active February 21, 2023 19:55
Python nostr client for air-gapped shit posting
""" Python nostr client to for air-gapped shit posting
Requirements:
- python-nostr: On the same folder the air_nostr.py is, clone and rename it
git clone https://github.com/jeffthibault/python-nostr
mv python-nostr python_nostr
- opencv, embit, qrcode
pip install opencv-python embit qrcode
@odudex
odudex / seed_qr.py
Last active August 31, 2023 12:08
Uses Embit and qrcode modules generates ascii compact seed QR code.
"""Uses Embit and qrcode modules generates ascii compact seed QR code.
Install Embit:
pip install embit
Exemple: Words as input:
python seed_qr.py picture body actor coil end satoshi fish mom distance proof thank play fantasy friend dinner clump boring ozone review cart virtual toss foot infant
"""
import sys
from io import StringIO
@odudex
odudex / TinySeed.py
Last active March 27, 2023 12:00
Uses Embit to convert BIP39 seed words to Tiny Seed format.
"""Uses Embit to convert BIP39 seed words to Tiny Seed format.
Install Embit:
pip install embit
Exemple: python tiny_seed.py rail price fiction dice orphan have allow spatial share country mixed gasp
"""
import sys
from embit.wordlists.bip39 import WORDLIST
@odudex
odudex / python_encrypt_methods_tests.py
Last active April 17, 2023 15:27
Compare data lenghts for different encryption methods and mnemonic formats
from io import StringIO
import hashlib
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
import base64
from qrcode import QRCode
from embit.wordlists.bip39 import WORDLIST
from embit import bip39
MNEMONIC_ID = "test_ID"
@odudex
odudex / krux_colors_generator.py
Created June 2, 2023 16:12
Krux color generator
"""
Create Krux colors from 8 bits RGB values
Type r g b arguments as 0-255 numbers
"""
import sys
def rgb888torgb565(color):
"""convert to gggbbbbbrrrrrggg to tuple"""
MASK5 = 0b11111
@odudex
odudex / krux_file_signer.py
Last active June 26, 2023 00:26
Sign files with Krux, airgapped and export openssl signature and public key
"""
This python script is aimed to help and teach how Krux can be used to sign files and create PEM public keys so openssl can be used to verify
Requirements:
- opencv, qrcode
pip install opencv-python qrcode
- This script also calls a openssl bash command, so it is required to have verification functionality
"""
import argparse