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);

Hal Finney's explanation of secp256k1 "efficiently computable endomorphism" parameters used secp256k1 libraries, archived from source.

The same optimization could be applied to any Koblitz curve (e.g. Short Weistrass curve with a=0).


I implemented an optimized ECDSA verify for the secp256k1 curve, based on pages 125-129 of the Guide to Elliptic Curve Cryptography, by Hankerson, Menezes and Vanstone. I own the book but I also found a PDF on a Russian site which is more convenient.

secp256k1 uses the following prime for its x and y coordinates: