Crypto Testing
Experimentation and research in cryptography.
Contains a number of experimental utilities for building cryptographic primitives and
a few experimental implementations.
It is hoped that some of the items here will be useful for other people who are also
studying cryptography in a JavaScript context.
In particular the implementations, computation algorithms and tests could be useful to help
improve understanding.
Installation
npm install @andybry/crypto-testing
Utilities
shared/big-int
: working with and converting to and from big intsshared/bit
: working with and converting to and from bitsshared/byte
: working with and converting to and from bytesshared/curve
: elliptic curve implementationshared/fp2
: implementation of field of order p squaredshared/random
: secure random generatorsshared/secp256k1
: parameters and associated elliptic curve implementationshared/string
: working with and converting to and from string representations of datashared/zn
: implementation of field of order p (or could be used for rings if n is not prime)
Scripts
npm run des
: implementation of the Data Encryption Standard (for 1 64-bit block)npm run des:node
: the same thing using nodes crypto
API for comparisonnpm run ecdsa
: demonstrates the implentation of ECDSA using secp256k1npm run ecdsa:vs-ethereum
: compares local signing and recovery with the Ethereum version (from web3.js)