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.6.0; | |
/* | |
* @dev Provides information about the current execution context, including the | |
* sender of the transaction and its data. While these are generally available | |
* via msg.sender and msg.data, they should not be accessed in such a direct | |
* manner, since when dealing with GSN meta-transactions the account sending and | |
* paying for execution may not be the actual sender (as far as an application | |
* is concerned). | |
* |
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
BITMASK32 = int('0xffffffff', 16) | |
def hash_name(name): | |
if any([ord(x) < ord('A') for x in name]): | |
return 1 | |
out = [] | |
for each in name: |
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
# exercise 2, generating shared key | |
from tinyec import registry | |
import secrets | |
curve = registry.get_curve('brainpoolP256r1') | |
def compress_point(point): | |
return hex(point.x) + hex(point.y % 2)[2:] |
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 math | |
import libnum | |
def func(a, x, y, p=37): | |
return ((3 * x ** 2 + a) * libnum.invmod((2 * y), p)) % p | |
def pp(x1, a, b, p=37): | |
y = libnum.sqrtmod_prime_power((math.pow(x1, 3) + a * x1 + b) % p, p, 1) |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"io" | |
) | |
type Tuple struct { | |
is_there bool; |
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
function [H] = my_dft(signal) | |
len = length(signal) | |
H = zeros(1:len) | |
for i = 1:len - 1 | |
for j = 1:len | |
H(i) = H(i) + signal(j) * exp(-2 * %i * %pi * j * i / len) | |
end |
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
close() ; close(); clear() | |
function [H] = compute_irc(signal) | |
// spectrum = real(fft(signal)); | |
H = signal .* window('kr', length(signal), 16); | |
endfunction | |
function [out] = compute_inv_irc(signal) | |
filter_fft = fft(signal) |
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 | |
from socket import \ | |
socket, \ | |
AF_INET, \ | |
SOCK_STREAM, \ | |
SOL_SOCKET, \ | |
SO_REUSEADDR | |
from selectors import DefaultSelector, EVENT_READ | |
from sys import argv, stderr | |
from threading import Thread |