Saturday, August 23, 2014

jUnit: Dynamic Tests Generation

Dynamic tests generation is useful when you need to run the same set of tests on many different input values or configurations. It can be achieved either using parametrized tests or using theories.

Theories are valuable when you have a bunch of data to be used as parameters and want to run tests on all their combinations. You get less control, but you do not have to write combining and iterating code by yourself. Basics about how theories work are explained on java code geeks (original at java advent calendar), so this post focus on parametrized tests.

Parametrized tests are better when you need to have good control over the input values, e.g. directory with files that are served as an input or a list of meaningful parameters combinations.

Wednesday, April 2, 2014

Placeholdered Maps

Placeholdered map is able to associate keys with values. User can add key value pairs into it and ask for data associated with keys. It works exactly as it would work in an ordinary map.

The additional feature is ability to use placeholders. Placeholder knows when it was created and is useful to cheat on order in which data were added into the map. If the user adds data into placeholder, the datastructure behaves as if the data were added when the placeholder was created.

We will create two such structures. First keeps key value pairs and can return last value associated with the key. Value added into placeholder is returned only if user did not added the same key after the placeholder was created. Second returns all values associated with the key in order they were put in. Placeholders can be used to add data in the middle of those lists.

Thursday, March 13, 2014

Falling Ball Game

I released simple html5 game called Falling Ball. The player uses arrows to move the ball left, right and to make it jump. You get one point for every hit platform and if the ball touches screen border, any of them, then the ball dies.

Wednesday, February 19, 2014

Cryptography & Theory 2: What is Pseudorandom

As was concluded in the first part of this series, security without randomness is impossible. Deterministic ciphers are unable to protect against strong attackers and true random generators are impractical or hard to get, so cryptography is build on pseudorandom generators.

First two chapters of this post define what they are and explain what kind of pseudorandom generators secure cryptography needs. Third chapter introduces yet another way how to talk and think about pseudorandom generators and ciphers in general.

Saturday, November 30, 2013

Cryptography & Theory 1: Meaning of Secure

Cryptography & Theory is series of blog posts on things I learned in coursera stanford online crypto class. The class contained just right mixture of theory, math and programming and I enjoyed it a lot.

This first part explains what is meant by expression "good cipher". It contains definition of a cipher and multiple definitions of cipher security. Although it does not sounds like much, it is one of the most important things I learned there.

It is important because ciphers are designed to protect against well defined attacks and are vulnerable to anything else. One can not just take random cipher from build-in ciphers list of his favorite framework and call it a day. One has to understand what is he choosing and why.

Thursday, July 4, 2013

Matasano Crypto Challenge

I recently finished Matasano Crypto Challenges and it was an interesting experience. I started doing them because @tqbf tweets with standings showed up in my tweet feed and made me feel competitive. Now I'm very glad I did them.

Update: competition is not running anymore. All exercises and official solutions are available on cryptopals.org. My solutions are written in java and stored in matasano-cryptopals-solutions github repository.

Crypto Challenges is a collection of 48 exercises that demonstrate attacks on real world ciphers and protocols. Exercises exploit both badly designed systems and subtle implementation bugs in theoretically rock solid crypto. Most importantly, they make you see how tricky the security can be and how much various details matter.

If you solved all exercises while the competition was running, Matasano donated 20$ to a charity.

Thursday, June 20, 2013

Building JavaScript Library with Grunt.js

New release of typical non trivial JavaScript project needs to run unit tests, concatenate all source files into one and minify the result. Some of them also use code generators, coding style validators or other build time tools.

Grunt.js is an open source tool able to perform all above steps. It is pluginable and was written in JavaScript, so anyone working on JavaScript library or project should be able to extend it as he needs.