Skip to content

Instantly share code, notes, and snippets.

View Uzlopak's full-sized avatar
☢️
🫠

Aras Abbasi Uzlopak

☢️
🫠
View GitHub Profile
@roramigator
roramigator / post.js
Created January 29, 2022 20:04
this guy wrote a dynamic tutorial on how to write a compiler all in the same single javascript file
'use strict';
/**
* TTTTTTTTTTTTTTTTTTTTTTTHHHHHHHHH HHHHHHHHHEEEEEEEEEEEEEEEEEEEEEE
* T:::::::::::::::::::::TH:::::::H H:::::::HE::::::::::::::::::::E
* T:::::::::::::::::::::TH:::::::H H:::::::HE::::::::::::::::::::E
* T:::::TT:::::::TT:::::THH::::::H H::::::HHEE::::::EEEEEEEEE::::E
* TTTTTT T:::::T TTTTTT H:::::H H:::::H E:::::E EEEEEE
* T:::::T H:::::H H:::::H E:::::E
* T:::::T H::::::HHHHH::::::H E::::::EEEEEEEEEE
@ledbit
ledbit / write.js
Last active February 14, 2022 12:29
nodejs buffer string write performance
'use strict';
function writeUTF8ToBuf(str, buf, off=0) {
for (let i=0; i < str.length; i++) {
const charcode = str.charCodeAt(i);
if (charcode < 0x80) buf[off++] = charcode;
else if (charcode < 0x800) {
buf[off++] = 0xc0 | (charcode >> 6);
buf[off++] = 0x80 | (charcode & 0x3f);

Paul Miller's explanation of endomorphism:


secp256k1 is Koblitz curve (e.g. Short Weierstrass curve with a=0).

Koblitz curves allow using efficiently-computable GLV endomorphism ψ:

  1. GLV endomorphism ψ transforms a point: P = (x, y) ↦ ψ(P) = (β·x mod p, y)
  2. GLV scalar decomposition transforms a scalar: k ≡ k₁ + k₂·λ (mod n)