Skip to content

Instantly share code, notes, and snippets.

from Crypto import Random
from Crypto.Cipher import AES
from Crypto.Cipher import Salsa20
from Crypto.Cipher import ChaCha20
from Crypto.Cipher import ARC4
from Crypto.Cipher import PKCS1_OAEP
from Crypto.Util import Padding
from Crypto.PublicKey import RSA
@lmyyao
lmyyao / binaryfile.py
Created March 2, 2020 11:49
python write c struct to file
from ctypes import *
import time
import datetime
class Record(Structure):
_fields_ = [
("time", c_double),
("count", c_double)
]
@HarryR
HarryR / bls12_381.sage
Created September 26, 2019 20:13
Sage script to derive all necessary parameters for BLS12-381 curve (including frobenius coefficients and montgomery reduction constants etc.)
field_modulus = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787
desired_curve_order = 52435875175126190479447740508185965837690552500527637822603658699938581184513
Fp = GF(field_modulus)
PARAM_A4 = 0
PARAM_A6 = 4
E = EllipticCurve(Fp, [PARAM_A4, PARAM_A6])
E_order = E.order()