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 tinyec.registry as reg | |
import random | |
def generates_secret_keys(curve): | |
priv_key = random.randint(0, curve.field.n) | |
pub_key = priv_key * curve.g | |
return (priv_key, pub_key) | |
def get_shared_key(priv_key_a, pub_key_b): |
This file has been truncated, but you can view the full file.
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
# Directed graph (each unordered pair of nodes is saved once): Cit-HepTh.txt | |
# Paper citation network of Arxiv High Energy Physics Theory category | |
# Nodes: 27770 Edges: 352807 | |
# FromNodeId ToNodeId | |
1001 9304045 | |
1001 9308122 | |
1001 9309097 | |
1001 9311042 | |
1001 9401139 | |
1001 9404151 |
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
# The main part was taken from https://towardsdatascience.com/understanding-lamport-timestamps-with-pythons-multiprocessing-library-12a6427881c6 | |
from multiprocessing import Process, Pipe | |
from datetime import datetime | |
def local_time(counter): | |
return ' (LOGICAL_TIME={}, LOCAL_TIME={})'.format(counter, datetime.now()) | |
def calc_recv_timestamp(recv_time_stamp, counter): | |
for id in range(len(counter)): |
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
#! /usr/bin/python3 | |
import os, sys, socket | |
class Sender: | |
def __init__(self, path, file_name, ip_addr, port): | |
self.path = path | |
self.file_name = file_name | |
self.ip_addr = ip_addr | |
self.port = port |
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
#!/usr/bin/python3 | |
class HillCipher: | |
def __init__(self, degree=2): | |
assert (degree == 2), "only 2 degree cipher is supported for now" # for now only 2x2 Hill ciphers are supported | |
self._modular_base = 26 | |
self._degree = degree | |
def encrypt(self, plaintext, key): | |
degree = self.degree() |
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
pragma solidity ^0.4.24; | |
contract ERC721 { | |
function getSerializedData(string _tokenId) public returns (bytes); | |
function demolishToken(string _tokenVIN) public; | |
function recoveryToken(address _owner, string _tokenVIN, bytes _serializedData) public; | |
} |
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
pragma solidity ^0.4.24; | |
contract ERC721 { | |
function getSerializedData(string _tokenId) public returns (bytes); | |
function demolishToken(string _tokenVIN) public; | |
function recoveryToken(address _owner, string _tokenVIN, bytes _serializedData) public; | |
} |