This file contains hidden or 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
| class Graph: | |
| def __init__(self): | |
| self.nodes = set() | |
| self.edges = defaultdict(list) | |
| self.distances = {} | |
| def add_node(self, value): | |
| self.nodes.add(value) | |
| def add_edge(self, from_node, to_node, distance): |
This file contains hidden or 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 time | |
| import hmac | |
| import struct | |
| import base64 | |
| import hashlib | |
| def code(secret): | |
| key = base64.b32decode(secret) | |
| message = struct.pack(">Q", int(time.time()) / 30) | |
| h = hmac.new(key, message, hashlib.sha1).digest() |
NewerOlder