Vash - Blog

Thursday, August 4, 2011

Vash 1.1

Vash 1.1 is out. These are the improvements we've made:

New Features


  • Salt. You can now specify salt bytes either as a string on the command line, or through a file, including stdin.

Algorithm Updates (1.1)


  • HMAC based image seeding. On the thoughtful advise of Phil Zimmermann (creator of PGP), we have moved to a SHA-512/SHA-256 HMAC based generator, from our existing SHA-512/MersenneTwister based generator.
  • Added new tree generator controls to allow for a broader range of output image appearances while preserving the basic look and feel of our prior generators.
  • New terminal node: Ellipse. Similar to RadialGradient, but draws with a hard edge, like Flower and PolarTheta.
  • Using a vector based approach to compute LinearGradient, rather than slope-intercept form. This avoids the need for an extra image copy and eliminates several nasty aliasing issues.

Command Line Improvements


  • File Input. You can now provide the data to vash directly from a file, including stdin.
  • Stdout Output. You can now have the file data written to stdout by specifying - as the target file.
  • Output Format. You can now specify the output format with -F/--format, rather than having us guess based on the extension. This is important when writing output to stdout.

Bug Fixes


  • We now enforce a minimum image size.
  • We now error if you specify more than one data string as input.

You can find links to the new release on our download page.

How to Multiply 10 Digit Numbers using nothing but Vash

The problem with multiplying in your head, or doing any big math problem without a pencil and paper, is memory. In order to multiply two 10-digit numbers, you need to store approximately 11 rows and 20 columns of intermediate numbers in working memory. This is beyond most people. It is certainly beyond me.

On the other hand, most people can, without any problem at all, identify 100-200 specific individuals in a giant crowd of people. Clearly then, it is possible for a normal human to hold in memory and recall at will 100-200 unique values.

Recently, Andrew Drucker of MIT discovered a clever way of making use of visual memory to do multiplication. The only difficult part of the algorithm is getting your hands on hundreds of unique images. Naturally, this is something that Vash can help with.

How to use this tool:

  1. Pick two numbers to multiply and put them in the text boxes below. The workspace below will automatically expand to give you room for any size number you want (with limits).

  2. Perform each step of the multiplication, as you would with pencil and paper, "storing" your intermediate result into the grid in the workspace.

    • To store a value, click on the cell to store in. We will pop up a unique vash image. Look at it for a bit: you will need to be able to pick it out of a crowd later. This is easier than it sounds, thanks to your visual memory.
  3. When you have finished all of the intermediate multiplications, you will need to tally up your results by adding down the columns.

    • It is unlikely, if you are like me, that you will remember all of the numbers you stored. When you need help recalling a number you stored in a cell, click on the cell again. We will pop up a dialog with 10 images in it, 0 through 9. One of them will be an image you have seen, the other 9 will be new to you. The number you stored is the number next to the image you recognize.
  4. Once you have filled in the cells in the bottom row, click on "Read Result." We will query you for each number in the output and write down your results.

Good Luck!

For the full suite of details, see the original excellent paper by Andrew Drucker.


 
x


Read Result

0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9

Thursday, July 14, 2011

Vash 0, GPU 1

Vash has been in development for just over one and a half years, moving between a personal side project, a low intensity skunkworks project, and a test platform for new technologies. While the majority of my time on it has been spent trying to find the ideal parameters to create images that are the right combination of visually pleasing, distinctive, and memorable, I also spent quite a bit of effort searching for Vash's Goldilocks platform.

The problem is twofold. On one hand, Vash's algorithm can be very computationally expensive, so we needed a fast language and platform. At the same time, Vash is a complex beast and the code really wants to make use of several different programming paradigms if it's going to be well organized. Some platforms were just too slow, some were too ugly, and others were unusably verbose. Sadly, none were "just right." We did not end up with an ideal platform: such a thing does not exist, at least not yet. This blog story is not about the platform we did end up using. Instead, it is about one of our more surprising failures.

Early in our endeavors, when it became clear that we needed more speed, we looked in the natural place to do image processing: the GPU (Graphics Processing Unit). I spent a couple of days integrating PyOpenCL (a wonderful framework that I highly recommend) with our existing codebase and rewriting the node implementations in OpenCL. Normally, we would express the computation as a tree walk, but GPUs don't really do branching, at least not at that depth. Instead, we walked the tree on the CPU to emit OpenCL code to call each function in turn and combine their results into a final image, all on the GPU.

The GPU programs that this process produced ran fast -- really, really fast. In total, it was able to generate Vash images about 100-500x faster than the equivalent C program. Sadly though, this isn't the whole story. AMD's and Nvidia's OpenCL compilers are optimizing compilers: they produce astonishingly fast code, but they take half an eternity to do so. Since we don't know what computations we are doing until we get data to hash, we can't precompile the programs -- to generate an image with this technique took about 50-100ns of GPU compute time... with about 20-60 seconds of compilation on the CPU leading up to that. Unfortunately, this turned out to be our slowest implementation, and an edifying lesson in hidden costs.

Of course, there are other ways to use the GPU that would not have this frontloaded overhead, even if they are less optimal. We eventually decided to do without a GPU implementation for other reasons. That, however, is a different blog post.

Wednesday, July 13, 2011

Introducing Vash 1.0

Over the last year and a half Vash has been a side project, a component of a larger product, something rewarding to hack on, and something fun to show friends. While there are other visual hashes and seeded-random image generators out there, we think that Vash is special, and there is nobody in our office who hasn't found themselves sitting and watching Vash images cycle by.

It's distinctive, it's consistent, it's reliable, and it's long past time we got Vash out into the world where other people can play with it too.

It's AGPLv3, grab it on our downloads page or visit Vash on GitHub.

If you want a commercial license, or custom work, both are also available.

What's it good for? We have a few ideas, but I'm confident that they'll look pretty tame compared to whatever it is you're coming up with right now.