By DoctorEvil on Nextcoin.org
Sponsored by MSIN on BitcoinTalk.org
NXT's Crypto.java and Curve25519.java look kosher aside from a signing bug that is currently being worked around.
| `/** @jsx React.DOM */` | |
| classSet = React.addons.classSet | |
| ReactCSSTransitionGroup = React.addons.CSSTransitionGroup | |
| ReactTransitionGroup = React.addons.TransitionGroup | |
| CarouselStateMixin = | |
| propTypes: | |
| items: React.PropTypes.array |
| # a pedagogical implementation of curve25519 with ec-kcdsa | |
| # coded by doctorevil to validate nxt's port of Matthijs van Duin's implementation | |
| # warning: this implementation is not timing attack resistant | |
| # ec arithmetic equations from http://hyperelliptic.org/EFD/g1p/auto-montgom.html | |
| from hashlib import sha256 | |
| from ecdsa.numbertheory import square_root_mod_prime, SquareRootError, inverse_mod | |
| CURVE_P = 2**255 - 19 | |
| CURVE_A = 486662 |
By DoctorEvil on Nextcoin.org
Sponsored by MSIN on BitcoinTalk.org
NXT's Crypto.java and Curve25519.java look kosher aside from a signing bug that is currently being worked around.
| CREATE TABLE accounts( | |
| id serial PRIMARY KEY, | |
| name VARCHAR(256) NOT NULL | |
| ); | |
| CREATE TABLE entries( | |
| id serial PRIMARY KEY, | |
| description VARCHAR(1024) NOT NULL, | |
| amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0), | |
| -- Every entry is a credit to one account... |
| ''' | |
| An authentication module for pyzmq modelled on zauth from czmq. | |
| The functions to read and generate certificates should be interoperable | |
| with czmq's zcert's - though are not as fully featured. | |
| ''' | |
| import datetime | |
| import glob | |
| import json |
| // The Census Pattern | |
| // Model 1, over XPUB-XSUB | |
| #include "czmq.h" | |
| static void | |
| counter_task (void *args, zctx_t *ctx, void *pipe) | |
| { | |
| void *counter = zsocket_new (ctx, ZMQ_XPUB); | |
| zsocket_set_xpub_verbose (counter, 1); |
| /***************************************************************************** | |
| * QuantCup 1: Price-Time Matching Engine | |
| * | |
| * Submitted by: voyager | |
| * | |
| * Design Overview: | |
| * In this implementation, the limit order book is represented using | |
| * a flat linear array (pricePoints), indexed by the numeric price value. | |
| * Each entry in this array corresponds to a specific price point and holds | |
| * an instance of struct pricePoint. This data structure maintains a list |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| import java.io.IOException; | |
| import java.net.InetSocketAddress; | |
| import java.net.ServerSocket; | |
| import java.net.StandardSocketOptions; | |
| import java.nio.ByteBuffer; | |
| import java.nio.channels.CancelledKeyException; | |
| import java.nio.channels.ReadableByteChannel; | |
| import java.nio.channels.SelectionKey; | |
| import java.nio.channels.Selector; | |
| import java.nio.channels.ServerSocketChannel; |