notfed / nonce Goto Github PK
View Code? Open in Web Editor NEWgenerate nonces for DNSCurve
generate nonces for DNSCurve
This project produces nonce.a, a simple nonce management library that implements the concept of nonces as defined by DNSCurve (see http://dnscurve.org/). All nonces are exactly 12-bytes. There are four branches, all with the same interface but defining nonces in slightly different ways: nonce12 - Uses a 12-byte counter starting from 0. Each time next_nonce is called, the nonce is incremented by one. nonce8rand4 - Uses an 8-byte counter starting from 0, plus a 4-byte random number. Each time next_nonce is called, the 8-byte counter is incremented by one, and the 4-byte random number is recalculated. tai12 - Uses a 12-byte TAI64N label (see http://cr.yp.to/proto/tai64.txt) re-calculated each time nonce_next is called. If the time has not changed (in the unlikely case where nonce_next is called twice quickly in succession), the number is incremented to ensure a unique nonce. tai8rand4 - Uses an 8-byte TAI64 label (see http://cr.yp.to/proto/tai64.txt) plus a 4-byte random number. The header nonce.h has the following operations: void nonce_create(const char *filepath); void nonce_next(const char *filepath, char *nonce); void nonce_separate(char *nonce, int nserv,int serv); void nonce_show(const char *nonce); A nonce is stored in a file, and the file must be accessed and updated each time a nonce is used, to prevent the same nonce number from being used twice. When a new nonce is needed, create a buffer of size NONCE_BYTES (defined in nonce.h), choose a filename, and call nonce_next. If the file does not yet exist, nonce_create will be called to create one for you. e.g.: char buf[NONCE_BYTES]; nonce_next("mynonce",buf); /* buf now contains a unique nonce */ If you want to support nonce separation (see http://dnscurve.org/out-implement.html) use nonce_separate after each nonce_next. The function nonce_separate takes two arguments: the total number of servers, and a zero-indexed number representing the current server: char buf[NONCE_BYTES]; nonce_next("mynonce",buf); nonce_separate(50,4); /* we are server number 5 of 50 */
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.