rock-paper-scissors-lizard-spock-stream
Streaming rock, paper, scissors, lizard, spock game extended from
npm install -g rock-paper-scissors-lizard-spock-stream
Usage
rock-paper-scissors-lizard-spock-stream allows you to play rock, paper, scissors, lizard, spock with a friend over any transport.
Using dupsh and airpaste this looks like
machine-1> dupsh 'rock-paper-scissors-lizard-spock-stream rock' airpaste
and on another machine
machine-2> dupsh 'rock-paper-scissors-lizard-spock-stream scissors' airpaste
This produces the following output
machine-1> dupsh 'rock-paper-scissors-lizard-spock-stream rock' airpasteYou won! rock beats scissors
machine-2> dupsh 'rock-paper-scissors-lizard-spock-stream scissors' airpasteYou lost! rock beats scissors
Programmatic usage
You can also use this as a module
var rps =var stream = // pass in your choicestreamstreamstreamsomeTransport
How it works
It works by creating an sha256 hmac with a random nounce as the key an your weapon choice as the data argument.
You then exchange this hmac with a friend and when both of you have received eachothers hmacs you expose your weapon and nounce allowing both parties to verify that you picked your weapon before knowing what your opponent choose.
License
MIT