Skip to content

Instantly share code, notes, and snippets.

@kklash
kklash / hmqv.py
Last active August 17, 2022 01:16
Ephemeral Diffie-Hellman key exchange using the HMQV algorithm.
import math
import secrets
import hashlib
import binascii
########################################
# This little script demonstrates an ephemeral diffie-hellman key exchange using the HMQV
# key agreement algorithm. HMQV provides a provably secure authenticated key exchange,
# and improved performance over the older & less rigorous MQV protocol.
#
@kklash
kklash / integral-fitting.md
Created July 2, 2022 23:16
Find a function that fits a given integral.

Integral Fitting

We want to find a function $f(x)$ whose integral over the range $0<=x<=m$ approaches 1, as $x$ approaches $m$. In math language:

$$\int_{0}^{m}f(x)dx=1$$

If we know $f(x)$, we can generalize it to find integrals that approach any arbitrary number, by simply scaling the output of $f(x)$.

This is useful for modeling targeted accumulation: some gradual accumulative process whose total sums up to some specific fixed value.

'use strict'
const wif = require('wif')
const { privateToPublic } = require('eosjs-ecc')
// 0x1bcFF2De0567009b5eEb0f525b19081B36EC4a1c ETH address
// EOS8VjDk9aGN1eRS6EMiw2h6Z5SXuqRm2NhLaqeNVR1km1NHxvqqp EOS address
// 0x03db1a5a27a75036fd5fbba7965463b350b52fe2d1fb3016ec0c3b83ecad7100fc pubkey
// 0xde0c2edaa197512ca6e3155c729090622f70db3c0b5fa199bd2c842442a87ad7 privkey
pragma solidity ^0.4.24;
contract Owned {
address owner;
constructor() public {
owner = msg.sender;
}
function withdraw() public {
require(msg.sender == owner);
'use strict';
const time = require('time');
const crypto = require('crypto');
const fs = require('fs');
const fetch = require('node-fetch');
const request = require('request-promise-native');
const { format } = require('util');
let KEYS // allow the api-keys to be global so functions can access them
#!/usr/bin/env node
"use strict";
const Web3 = require('web3')
const request = require('request-promise-native')
const eos_contribution_address = '0xd0a6E6C54DbC68Db5db3A091B171A77407Ff7ccf'
const abi_query_url = 'http://api.etherscan.io/api?module=contract&action=getabi&address='
function prompt(question) {
@kklash
kklash / flyp.js
Last active May 2, 2018 02:16
basic flyp.me javascript demonstration
#!/usr/bin/env node
"use strict";
// flyp.me/api
process.binding('http_parser').HTTPParser = require('http-parser-js').HTTPParser
// ^This is needed because flyp.me's API sends malformed headers ._. ^
// https://stackoverflow.com/questions/36628420/nodejs-request-hpe-invalid-header-token
// npm install http-parser-js
const request = require('request-promise-native')
#!/usr/bin/env node
// https://www.morphtoken.com/api/
const request = require('request-promise-native')
const baseUrl = 'https://api.morphtoken.com'
function prompt(question) {
return new Promise(resolve => {
const { stdin, stdout } = process

Keybase proof

I hereby claim:

  • I am kklash on github.
  • I am kklashinsky (https://keybase.io/kklashinsky) on keybase.
  • I have a public key ASAxQKfA9XHz2ZFuAWURqdBGSE0R1ZWgKmbT0G48e5EKzgo

To claim this, I am signing this object: