Skip to content

Instantly share code, notes, and snippets.

@simform-solutions
Last active September 20, 2017 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simform-solutions/cadec7b1395881acc0e55d195b96b618 to your computer and use it in GitHub Desktop.
Save simform-solutions/cadec7b1395881acc0e55d195b96b618 to your computer and use it in GitHub Desktop.
import getpass
import hashlib
import json
import time
import datetime
import re
import os
import RPi.GPIO as GPIO
from operator import itemgetter
from iota import Iota, ProposedTransaction, Address, TryteString, Tag, Transaction
from iota.crypto.addresses import AddressGenerator
from iota.commands.extended.utils import get_bundles_from_transaction_hashes
import iota.commands.extended.get_latest_inclusion
from iota.json import JsonEncoder
# Returns a sha256 hash of the seed
def create_seed_hash(seed):
s = hashlib.sha256(seed)
return s.hexdigest()
# Returns a sha256 hash of seed + address
def get_checksum(address):
data = address + seed
s = hashlib.sha256(data)
return s.hexdigest()
# Verifies the integrety of a address and returns True or False
def verify_checksum(checksum, address):
actual_checksum = get_checksum(address)
if actual_checksum == checksum:
return True
else:
return False
# Will ask the user for a yes or no and returns True or False accordingly
def yes_no_user_input():
while True:
yes_no = raw_input("Enter Y for yes or N for no: ")
yes_no = yes_no.lower()
if yes_no == "n" or yes_no == "no":
return False
elif yes_no == "y" or yes_no == "yes":
return True
else:
print("""Ups seems like you entered something different then "Y" or "N" """)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment