Git Product home page Git Product logo

hello-future's Introduction

hello-future

Sending messages into the future

This is a Python script which reads lines of text from the input, and then creates another Python script which will write out the same messages to the terminal.

The twist is that the decoding will take the same amount of time (up to a constant factor) as it took to encode it. You could use this to write a message, post it publicly, and be sure that nobody will be able to read it within a certain period of time.

Installing

hello-future requires the following:

  • Python 3 (tested with version 3.4.2)
  • pycrypto (tested with version 2.6.1)

Using

To encode a message, do this:

$ time python3 hello-future.py msg.py
Write your messages one line at a time. They will be replayed in real time
(times a constant factor) by the Python program.

Press ctrl+C to terminate.

> Hi!
> This is my message.
> ^C
Exiting...

real    0m4.633s
user    0m4.584s
sys     0m0.004s

Now your message is encoded into the file msg.py, and executing this will print the message:

$ time python3 msg.py 
----------------------------- START OF MESSAGE -----------------------------
Hi!
This is my message.
------------------------------ END OF MESSAGE ------------------------------

real    0m35.098s
user    0m34.484s
sys     0m0.464s

Decoding then takes a time proportional to the encoding. In my case, decoding is roughly ten times slower, but this is implementation-dependent.

Technical details

Messages are encrypted with AES-256, using keys from a chain of SHA-256 hashes. The following pseudocode describes the encoding process:

key = initial_key
while not end_of_input:
    key = sha256(key)
    if has_new_message():
        encrypted_message = aes256(key, get_message())
        save(encrypted_message)

Typically, there will be millions or billions of steps between messages. Since the hash chain can not be parallelized, it does not matter how much computing power you have access to.

The current Python implementation can decode at a speed of about 100,000 hashes/second on a desktop system, with specialized hardware this could probably be pushed up to some tens or hundreds of millions of hashes/second, but it should be nearly impossible to do it much faster than this in the foreseeable future.

To make this tool more practical one should try to bridge the gap between the desktop performance and that of specialized hardware, and processors with built-in AES and SHA support should be able to come pretty close.

hello-future's People

Contributors

robertostling avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.