Skip to content

Instantly share code, notes, and snippets.

View cromefire's full-sized avatar

Cromefire_ cromefire

View GitHub Profile
@cromefire
cromefire / crypto.ts
Created August 1, 2019 12:25
ECIES like/alternative for Python & TypeScript
// DISCLAIMER: I cannot guarantee that this is secure
import { Encryptor } from "./encryptor";
/**
* Generates a shared secret and a public key, private key immediatly discarded
*/
async function derive(
remotePub: ArrayBuffer
): Promise<{ key: Uint8Array; pub: Uint8Array; salt: Uint8Array }> {
@cromefire
cromefire / helper.py
Last active January 10, 2019 08:21
Import helper for relative imports
from os.path import join, dirname
from sys import version_info
def calculate_module_name(base_file, base_module, path):
"""
Calculates module name of a target module from base file and relative path
:param base_file: Path of the base file (__file__)
:type base_file: str