A Caesar Cipher Quiz Generator from a Smart Contract
Smart contracts are so cool, and where we can create code which is trustworthy, and run in a verifiable way. Our future work could create a whole governance infrastructure which could run from these magical contracts.
So, at the moment, I am moving my cipher challenge infrastructure onto smart contracts and will use smart contacts to generate questions and answers from the Ethereum blockchain.
The code I have initially designed will be a simple Caesar cipher, and where we will take a range of words, and then move these words by a given number of places:
In this case, we have two public methods: generate(), and caeser(). With generate() we will generate a new cipher challenge, and with the random shift value, and to show the shifted version and the solution. With caeser() we pass in a string, and then the shift value, and will return the cipher.
We can first use Remix to enter the code and compile: