In article <1137873033.046262.256300 / g49g2000cwa.googlegroups.com>, "asplake" <mjb / asplake.co.uk> writes: > Matthew, thank you for sharing your results (and in the form of test > cases). Pleased to report that mine are identical (and pass!). > me too :-) > BTW it's not hard to work out (and - hint to Chris - validate) the grid > dimensions from the folds so my function takes just the one argument. > Good hint. But doesn't that imply that any input is valid? E.g. LR is ok for a 4x1 sheet (giving 4,1,2,3). Or did you introduce a rule that the input has to be a square? I suggest other tests based on my solution def test_1024_1024 xpct = 'b5319b3045af0ab0f931dacca739d90a' md5 = MD5.new(fold(1024,1024,'TRTRTRTRTRTRTRTRTRTR').join(' ')) assert_equal xpct, md5.hexdigest end def test_2048_2048 xpct = '8e046199eee20b097e4948a5ea503516' md5 = MD5.new(fold(2048,2048,'TRTRTRTRTRTRTRTRTRTRTR').join(' ')) assert_equal xpct, md5.hexdigest end (you need to add a 'require "md5"' to the test skript, the array itself is a bit lengthy ;-)) For larger sheets my system (512M) starts to swap too much. Probably I should have used a singe array instead of three dimensional arrays of arrays... Morus