MPMP12 Marching band Problem

Marching Band problem

In this document I describe a solution to the ‘marchingband’ problem as stated on think-maths:

What is the fewest number of performers you require for your marching band to
have 64 marching options? (Only whole positive numbers will be accepted)

Where a ‘marchingband’ can march only in a rectangular shape.

Also, I present solutions in higher dimensions, and a solution with complex numbers, and a proof that the 2D case has a solution for all numbers of marching options.

MPMP9 Take away triangles

The puzzle: Take away Triangles.

Playing with the triangles, and looking at n-gons with n >= 3, I found you always end up in some cycle ( well, unless you start with irrational numbers on the triangle’s corners ), then googling for a couple of cycle lengths, I found this integer sequence related to your triangles puzzle:

https://oeis.org/A038553

  • Maximum cycle length in differentiation digraph for n-bit binary sequences.

MPMP8 Paper folding challenge

This post describes my solution to Matt Parker’s puzzle #8:

My solution involves looking at the pattern of folds when viewing the folded stack from the sides. And then using some python code to generate all possible ways the folds can match up in a way that you will still end up with two rows of 4 sheets.

MPMP7 - Unique distancing

Solver for n-dimensional variants of the MPMP7 Unique Distancing problem.

Project with tools for the 7th Matt Parker Math Puzzle problem.

  • Solution for the problem stated in the MPMP7 youtube video.
  • Solutions for smaller and larger grids.
  • Solutions in 3 or more dimensional grids
  • Can I fit more markers on the grid?
  • Can I solve this on an 8x8 grid?
  • Do solutions exist for larger 2D grids?

Several problems I ran in to while trying out gohugo

Several problems I ran into as a novice gohugo user.

  • the quickstart example does not work.
  • some content fails to render without any error message
  • don’t name your post ‘index.md’
  • posts without a frontmatter are not clickable, but do show in the index.
  • the ‘more’ looks like another post, while it is intended as a summary of ‘other’ posts.
  • no date in frontmatter the year 1 is assumed.
  • Overly complicated error messages:
  • it was not clear to me at first that you do need the extra subdirectory level under contents.
  • how do i select what part of my post i want in the summary.
  • The summaries are not always rendered properly, creating an ugly index page.

features which I would like to see in c++

Some c++ features I have looked for, but do not exist.

  • a std::min or compare which works for differently signed or sized arguments
  • an iteratorrange, which takes a pair of iterators
  • a way to test for the existence of a type in std::enable_if
  • initialize a subclass field before a baseclass
  • auto on class members
  • nested structured binding
  • automatic context deduction for switch

The MSM 8974 bootrom

Analyzing the Qualcomm MSM 8974 bootrom.

The bootrom is 192k byte in size. It has bootcode for the three main subsystems of the 8974:

  • the modem - qdsp4 / hexagon code
  • RPM - the power manager - ARM code
  • The Application cpu - ARM code

All devices I have inspected have the same bootrom. But a facitlity exists to apply patches to the bootrom via the use of special fuses.

Unfortunately the fuses in my device are configured in a way that the ‘patch’ area is not readable.

A problem I had with my timemachine backups

For several weeks my timemachine backup failed, being stuck in ‘inprogress’ with lots of disk activity occurring. The culprit turned out to be spotlight, trying to index the backupdisk while timemachine was trying to backup to it. adding my backupdisk in the ‘privacy’ tab of spotlight resolved the problem.

in the process list, processes with ‘md’ in the name, like mds_stores and ‘mds’ and mdworker_shared belong to spotlight. Timemachine is handled by ‘backupd’.

tmutil is the commandline tool for managing timemachine. mdutil is the commandline tool for managing spotlight.

a simple fix for the missing mipsel error in the android sdk

A problem I ran into a few times: after reinstalling or updating the android sdk, suddenly some projects starts failing to compile with a message about a missing ‘mips64el’ path.

The following will fix this:

mkdir -p $ANDROID_HOME/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/
mkdir -p $ANDROID_HOME/ndk-bundle/toolchains/mipsel-linux-android-4.9/prebuilt/darwin-x86_64/

touch $ANDROID_HOME/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/NOTICE-MIPS64
touch $ANDROID_HOME/ndk-bundle/toolchains/mipsel-linux-android-4.9/prebuilt/darwin-x86_64/NOTICE-MIPS

Vim Encryption investigated

VIM can encrypt text files transparently. I wrote a python script which can decrypt all three types given the password, or do a simple dictionary search.

Never use the old methods ( zip and blowfish ) the way these are used in VIM is broken. The latest blowfish2 method is somewhat better, though there is room for improvement.

Writing portable python code

Portable python

When writing python code I try to write code which will run both on python2 and python3. Below is a list of items I regularly use.

I know there is a module named ‘six’ which probably also handles some of these cases, I still need to look into that.

Hexdumper for C++ IOStreams

A hex::dumper object which can output hexdumps in several ways, configured by using various stream manipulators. Usage is as simple as:

std::cout << hex::hexstring << hex::dumper(data, size) << std::endl;

or

std::cout << hex::offset(0x12000) << std::hex << hex::dumper(data, size) << std::endl;

Benchmarking some python crypto libraries

I wrote a little benchmark, comparing the PyCrypto and cryptography python modules.

You can find the script here.

results

Most symmetric ciphers are significantly faster in pyCrypto for small blocksizes. but cryptography is much faster for larger data.

The ratio is the byterate of pycrypto divided by the byterate of cryptography. So values less than 1 mean: cryptography is faster, values larger than 1: pycrypto is faster.

I found that the cryptography library is generally faster for large data volumes, while pycrypto is faster for encrypting small items.

PDF Certificate Encryption

Code for this project can be found here: https://github.com/nlitsme/pyPdfCrack

PDFS can be encrypted in several ways, the simplest being the std encryption, using an owner and user password. A more secure way is to use password protected certificates. In this post I describe how exactly these certificates are encrypted, and how they are used to decrypt a pdf. Also I provide python code for parsing the certificate, pdf and do the decryption. Finally I wrote some simple password cracking tools for the certificate.

About bitcoin addresses ambiguity

A bitcoin address is the hash of an elliptic curve point representation. Bitcoin addresses are ambiguous in several ways.

  • First: This point can be represented in two ways: ‘full’, or ‘compressed’.
  • Then, there are some points which can be represented in two ways, this is because the group order is not exactly 2^256, but a little bit less.
  • Another issue: during signature checking, the sign of an equation is ignore, leading to more ambiguity.

Key Exchange

Note: this post is more philosophical, it does not describe any actual useful keyexchange algorithm.

Looking at how keyexchange protocols are constructed. And trying (unsuccesfully) to formulate a set of rules for constructing a keyexchange protocol.

Exploring the bitcoin blockchain

Most bitcoin transactions are ‘standard’, some are not. This is a summary of what is not standard in the bitcoin blockchain. Some interesting finds: the wikileaks cable’s are in the blockchain, and so are a bunch of links to childporn sites.

itsutils

itsutils is a set of tools that make life of the windows ce hacker easier. for instance, with pmemdump you can inspect the memory of the kernel or running processes.

  • with ‘psetmem’ you can modify memory
  • with pregutl you can read or change the devices register.
  • with pmemmap you can get a quick overview of what physical memory is mapped where.
  • with pps you can get a list of processes, threads or modules.
  • with pdocread, pdocwrite you can read disk-on-chip flash chips.
  • with psdread, psdwrite you can read/write sdcards.
  • with ppostmsg you can send windows messages to windows, or list all windows on the device.

Strange byte sequence in wince arm binaries

These 0x90 bytes ( or 0x24 dwords ) occur often in windows ce arm binaries

00000000 00004033 00444101 09401050 00004005 00534c01 09401050 00002078
00534c01 802910ec 0000c0f0 00534b01 812910ec 00000000 00545204 813910ec
0000900b 00545204 813910ec 0000d0c9 00545204 813910ec 0000e04c 00545204
13001186 000050ba 004c4404 0020100b 0000a0cc 00474e05 905010b7 00006008
00433306 920010b7 00000476 00433306

Demon dialer control program

The demon dialer was a blue-box, sold by hacktic.

I wrote these tools to be able to dialing lots of phonenumbers relatively quickly, while recording information about whatever answered. I used to do this in order to find some way of accessing the early internet.

Now available on github.

Game of Life

One of my early LIFE implementations.

I think I implemented this on almost every computer I owned, I remember writing my first version in Basic on my PET-2001.

Now available on github.