And How Are You Doing Today?

April 18, 2018 7 comments

Ok, so, who am I, and what should I do next? Out of curiosity, did you you ever ask those questions to yourself, especially the zen-like, first question? (The comments section is open, if you’d like to share 🙂

My last substantive blog post was on 11/17/17. In that delightful and uplifting post, I announced to the world that I was diagnosed with Stage 3B, Non-Small Cell, Lung Cancer (NSCLC). Phew, that’s a mouthful, but that’s the way it is in the world of cancer-speak.

Shortly after my world-shaking announcement, my oncologist declared that I had “advanced” to stage 4 – which meant that the cancer had migrated from its original source, my right lung, to elsewhere in the body. That “elsewhere“, ended up being my brain. After complaining about a painless, but noticeable, limp in my right leg due to an unexplained numbness, a full body MRI showed that 4 new tumors had popped up in my brain. Delightful!

After having each one of those little brain-shits blasted with radiation from Cyberknife technology, and having the four original tumors in my right lung assaulted with Opdivo immunotherapy infusions, I’m doing pretty damn well good. And this is 2 years after the fact! How are you doing today? 🙂


So, as of today, 4/18/18, I’m doing really well, both physically and mentally, for a stage four cancer patient.

I don’t know what, or when, or how often, I’ll be blogging about some topic in the future, but I’ll bet it will be about my experiences battling with the emperor of all maladies, the king of all diseases…. Cancer.

Categories: Cancer


November 29, 2017 Leave a comment

In one year, Bitcoin has risen 10X. An incredible, unprecedented event in the history of investment. A substantial price pullback seems in the cards, but the world has never seen a financial innovation like Bitcoin.

Categories: bitcoin

Coming Clean….

November 17, 2017 16 comments

Just in case you were wondering why I haven’t been blogging about Bitcoin, C++ programming, and/or dysfunctional management behaviors. I’ve decided to come clean….

In late February 2016, I was diagnosed with Stage 3B, Non-Small Cell Lung Cancer (NSCLC).

There, it took almost two fuckin’ years to get the courage to do so, but I’ve said it. Any kestions?

Yes, I’m serious; Yahoo Serious!

Categories: Cancer

The State Of Bitcoin

May 23, 2017 2 comments

Well, that’s all fine and dandy for us bitcoiners. What most people that have recently “seen the light” don’t know is that the brutal scaling war going on behind the scenes can tear the price in half (at least) in the near future.

Categories: bitcoin

Encrypting/Decrypting For Confidentiality

May 20, 2017 1 comment

Depending on how they’re designed, there are up to 5 services that a cryptographic system can provide to its users:

In my last post, Hashing For Integrity, we used the Poco.Crypto library to demonstrate how one-way hash functions can provide for message integrity over unsecured communication channels. In this post, we’ll use the library to “Encrypt/Decrypt For Confidentiality“.

The figure below shows how a matched symmetric key/cipher pair provides the service of “confidentiality” to system users. Since they are “symmetric“, the encryption key is the same as the decryption key. Anyone with the key and matching cipher can decrypt a message (or file) that was encrypted with the same key/cipher pair.

The gnarly issue with symmetric key cryptographic sytems is how to securely distribute copies of the key to those, and only those, users who should get the key. Even out-of-band key transfers (via e-mail, snail mail, telephone call, etc) are vulnerable to being intercepted by “bad guys“. The solution to the “secure key distribution” problem is to use asymmetric key cryptography in conjunction with symmetric key cryptography, but that is for a future blog post.

To experiment with symmetric key encryption/decryption using the Poco.Crypto library, we have added a MyCrypto class to the bulldozer00/PocoCryptoExample GitHub repository.

The design of the Poco.Crypto library requires users to create a CipherKey object directly, and then load the key into a Cipher acquired through a CipherFactory singleton.

The MyCipher class data members and associated constructor code are shown below:

After the MyCipher constructor has finished executing, the following CipherKey characteristics appear in the console:

Note that for human readability, the 256 bit key value is printed out as a series of 64, 4 bit hex nibbles.

So, where did we get the “aes-256-cbc” key name from, and are there different key generation algorithms that we could’ve used instead? We got the key name from the openssl library by entering “openssh -h” at the command line:

Using “des-ede” as the key name, we get the following console output after the constructor has finished executing:

The number of bits in a CipherKey is important. The larger the number of bits, the harder it is for the bad guys to crack the system.

So, now that we have a matched CipherKey and Cipher object pair, let’s put them to use to encrypt/decrypt a ClearText message. As you can see below, the Poco.Crypto library makes the implementation of the MyCipher::encryptClearTextMsg() and MyCipher::decryptCipherTextMsg()  member functions trivially simple.

The unit test code that ensures that the ClearText message can be encrypted/decrypted is present in the  MyCipherTest.cpp file:

The console output after running the test is as anticipated:

So, there you have it. In this post we employed the Poco.Crypto library to learn how to use and test the facilities provided by the library to simulate a crypto system that provides its users with confidentiality using encryption/decryption. I hope this post was useful to those C++ programmers who are interested in cryptographic systems and want to get started coding with the Poco.Crypto library.

Categories: C++ Tags:

Hashing For Integrity

May 3, 2017 5 comments


Before I discovered the wild and wacky world of Bitcoin, I didn’t pay much attention to cryptography or system security. Those intertwined subject areas, though important, seemed boring to me. Plus, the field is loaded with all kinds of rich, complex, terminology and deep, bit-wise, computationally-intensive, mathematical computations:

Symmetric/Asymmetric key generation algorithms, secure key distribution, private/public key pairs, block and bitstream cipher algorithms: DES, 3DES, AES, Blowfish, encryption by substitution/translation, hashing algorithms for integrity: MD5, RSA, SHA1, SHA2, RIPEMD-160, digital signatures, message digests, confidentiality, authentication, non-repudiation.

But now that I’m a “Bitcoiner“, all these topics suddenly seem interesting to me. Thus, I decided to look for a C++ Crypto library and write some buggy, exploratory, code to learn what the hell is going on.

Out of the gate, I didn’t want to get bogged down or overwhelmed by interfacing directly with the bedrock openssl C library API which underpins most higher level Crypto libraries. I wanted an easier-to-use, abstraction-oriented wrapper library on top of it that would shield me from all of the low level details in openssl

I didn’t have to look far for a nice C++ Crypto library. Poco has a Crypto library. Poco is a well-known, highly polished, set of general purpose, open source libraries/frameworks that is widely deployed across the globe.

The next thing I needed to do was to narrow down the scope of the project. Instead of hacking together some big complicated application, I decided to learn how “hashing achieves message integrity“.

Hashing For Integrity

A hash is a one-way function. When a message, large or small, is sent through a hashing algorithm, the resulting output is NOT an encrypted message that can be decrypted further downstream. It’s a simple, fixed size (in terms of number of bits) value also known as a message “fingerprint“, or “digest“.

Let’s say “I owe you $100” and you want an acknowledgment from me of that fact. I could write it down on paper, sign the note, and give it to you. My signature conveys the fact that I authorized the IOU and it gives the message a degree of integrity.

If you received the note without my signature, I could deny the IOU and I could deny ever sending the note to you. I can even say that you made it up out of thin air to scam $100 from me.

By providing you with an electronic version of the “I owe you $100” note AND a fingerprint in the form of a hash value derived from the content of the note, you could at least verify that the note content is legit and hasn’t been tampered with.

You would do this verification by locally running the note content through the exact same hash function I did, and then comparing your hash value with the fingerprint/digest supplied directly with the note. If they match, then the note is legit. Otherwise, it means that the note was “altered” sometime after I generated the first hash value. Any little change, even a one bit mutation to the message, invalidates the fingerprint derived from the unaltered message. That’s the nature of hashing.

Using Poco::Crypto::SHA1Engine For Hashing

The class diagram in the figure below shows what I needed from the Poco.Crypto library in order to code up and simulate the behavior of a hashing system.

The Poco::Crypto:SHA1Engine class implements the SHA-1 message digest algorithm. (FIPS 180-1, see ( ). Here’s a simple code usage example in which: an engine is created, a message is sent to it, and a hash value is returned:

The following console output from the code shows that the SH1Engine, in its default configuration, generates 160 bit hash values. The SH1Engine::digestToHex() converts the bit pattern into 40, 4bit, nibbles and returns a human-readable hexidecimal string:

The PocoCryptoExample Project

Using the Eclipse CDT, I coded up the design in the class diagram from the previous section. The PocoCryptoExample source tree is available on GitHub here: All you have to do is download the source tree, import it into Eclipse as “an existing Eclipse project“, and build the executable using the internal CDT builder (see

The test driver code that exercises the design (in MessageIntegrityTest.cpp) is as follows:

  1. Initializes the Poco Crypto library (which in turn initializes the openssl library).
  2. Creates the Sender, Recipient, and the I owe you $100” message.
  3. Invokes the Sender to compute the message fingerprint, set the message and fingerprint within a ChannelMessage, and transmit the result to the Recipient.
  4. Upon receipt of the transaction status (success/failure) back from the Recipient, the test driver prints the result to the console.

The test driver then:

  1. Commands the Sender to simulate a man-in-the-middle attack by maliciously changing the message content to You owe me $10,000” and sending a  new ChannelMessage to the Recipient without changing the fingerprint from the prior ChannelMessage.
  2. Upon receipt of the transaction status (success/failure), the test driver prints the result to the console.
  3. Uninitializes the Poco Crypto library (which in turn uninitializes the openssl library) and exits.

Here is the console output produced by the program:

What’s Next?

A next step in the learning process can be to integrate a Poco::Crypto::Cipher class into the design so that message encryption/decryption capability can be added. As you can see from the example code on the Poco Cipher API page, it’s not as easy as adding the SHA1Engine. It is more difficult to create/use a Cipher object because the class depends on the CipherFactory and CipherKey classes.

With those additions, we can simulate sending an encrypted and fingerprinted (integrity AND confidentiality) message to “matchedRecipients who have the same Poco.Crypto objects in their code. A Recipient would then use the SH1Engine to first check that the fingerprint belongs to the message. If the message passes that test, the recipient would then use the Cipher to decrypt the message content.

You know what would be great? If the ISO C++ standards committee added a <crypto> library to the C++ standard library to complement the impressive random number generation and probability distribution functionality available in <random>.

Categories: C++ Tags: ,

Bitcoin Echo Chambers

Categories: bitcoin
%d bloggers like this: