Skip to content

Instantly share code, notes, and snippets.

View johansten's full-sized avatar
🎯
Focusing

Johan Stén johansten

🎯
Focusing
  • Future Tense
  • South East Asia
View GitHub Profile
@johansten
johansten / blindsig.py
Created February 29, 2020 11:50
ed25519 chaumian blind signatures
from scalar import Scalar
from ed25519 import G, KeyPair, challenge
from group_element import GroupElement
class IssuerSession(object):
def __init__(self, kp):
self.x = kp.x
self.P = kp.P
self.k = Scalar.random()
import hashlib
class Global(object):
q = 2**255 - 19
l = 2**252 + 27742317777372353535851937790883648493
d = -4513249062541557337682894930092624173785641285191125241628941591882900924598840740
bx = 15112221349535400772501151409588531511454012693041857206046113283949847762202
by = 46316835694926478169428394003475163141307993866256225615783033603165251855960
Verifying my Blockstack ID is secured with the address 1Jtshmpf4xMFx6maqdk6XpbGe5X67QxioR https://explorer.blockstack.org/address/1Jtshmpf4xMFx6maqdk6XpbGe5X67QxioR

Keybase proof

I hereby claim:

  • I am johansten on github.
  • I am johansten (https://keybase.io/johansten) on keybase.
  • I have a public key ASBLMLO01yV9A1NCJ7BPG4BH1SAwfYnzUCwaqked5Df9qAo

To claim this, I am signing this object:

@johansten
johansten / gist:8414225
Created January 14, 2014 06:53
Unescaping html entities
#-------------------------------------------------------------------------------
# John J. Lee, http://www.velocityreviews.com/forums/t511850-how-do-you-htmlentities-in-python.html
#-------------------------------------------------------------------------------
import htmlentitydefs
import re
def unescape_charref(ref):
name = ref[2:-1]
base = 10
@johansten
johansten / GLSL randomize
Created September 5, 2012 09:17
The canonical "fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453)" didn't work on Mali-400, so replaced sin() w/ approximation
float a = fract(dot(v_texCoord.xy, vec2(2.067390879775102, 12.451168662908249))) - 0.5;
float s = a * (6.182785114200511 + a*a * (-38.026512460676566 + a*a * 53.392573080032137));
float t = fract(s * 43758.5453);