Last active
September 20, 2017 06:48
-
-
Save simform-solutions/cadec7b1395881acc0e55d195b96b618 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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