My encryption code is now live on GitHub

I developed Pivot initially on Windows, (a Linux version will follow) though the differences are fairly small. I used the Windows _sopen_s for reading and writing files. There shouldn’t be too much differen otherwise, though I guess I’ll find out when I compile it on Ubuntu or Raspberry Pi.
The program itself is around 450 lines of C in just one file. It can encrypt around 6 MB/s on my five year old i7 5930K PC and decrypt at around 10 MB/s.
If anyone could try this, I’d be very happy. It has one minor issue that I will resolve. Because it processes files in blocks of 64 bytes, it tends to round the output file when decrypting and adds a few 0s on the end. I will get it sorted
I’ve given it a very liberal MIT license, you can do what you want with it. Instructions on using it are provided on that link to GitHub.
This BTW is the encryption code at the heart of it.
int bit = 128;
for (int bi = 0; bi < 8; bi++) {
for (int b = 0; b < NUMSTREAMS; b++) {
dataout[b] = (dataout[b] >> 1) | (data[b] & bit);
data[b] <<= 1;
}
}
// Now alter the order of bytes according to the key
for (int i = 0; i < NUMSTREAMS; i++) {
data[i] = dataout[_key[i]];
}
The first double for loop slices 64 bytes into 64 bit streams. It’s pivoting the bits if you like, hence the name. The second for loop is what does the donkey work of encrypting it. It uses a 64 byte key (made up of 64 numbers 0-63- shuffled). As there are 1.2688693e+89 different ways of arranging these 64 numbers, if you lose the key it might take you a while to brute force it!
So I believe that it is an original encryption algorithm, but I am not an expert in cryptography so I might be making a fool of myself! Whether there are any possible attacks against it, I don’t know, but it will be interesting to see!
Sometimes you just need to view or maybe a binary file and here I’ve done that on the compiled file for asteroids.
If you are using RNGs (Random Number Generators) for cryptography then you need one that has been validated for sufficient randomness. For example the
At some time or other you are going to need a binary editor, to let you look in files and see what they contain.
Here’s it on 
I needed this in a bit of debug code. I wanted it to work like printf where there’s a format string containing one or more % format specifications and then write this into a buffer and dump it where ever.
So after yesterday’s post I also installed Code::Blocks on Ubuntu 20.04 LTS, the recent six monthly Ubuntu release. Guess what, it’s a much newer version of Code::Blocks that looks slightly different and does include SDL2. Although the demo program it creates is C++ not C (That coloured bar picture is the demo). I haven’t used it enough to see what’s different between this and version 16.01.
