The wikipedia page on TwoFish points at this reference implementation in C (and code) which is fine, but it lacks a main
and my first few passes at implementing one didn't correctly process any of the "known vector" test cases I attempted. I suspect I'm looking at a problem of not using the API correctly but I have no idea where to start looking for the error. Rather than beat my head on that one, I'd rather start with a codebase that:
- Runs out of the box
- Has tests
- Is self contained
- Is written for clarity
I also have a strong preference for C or C like C++ code.
Note: I'm more interested in code readability than anything else at this point. Small, simple code that can encrypt and decrypt a single block and a main function that hard codes a call or three would be ideal. Most anything beyond that (like any user interface) will just be noise for my use case.
Also, anything that has a licence more restrictive than Boost will be useful to me only as an source of know good values and states to compare with.
I eventually found this Python implementation derived from the C implamentation I listed above. The root cause of my issues turned out to be that the words of the key were in the wrong order.