I am working on a C++ program which implements some encryption algorithms (AES, Blowfish) and I need to obtain some metrics for evaluation. Specifically I need to measure the data of an encryption/decryption operation in kilobytes per second. This operation would use the same plain text data to measure different algorithms. Part of this is simply making use of a timer to obtain the seconds, and the second part is to count the number of bits. From here I can calculate the kilobytes per second.
The issue I'm trying to solve is how to measure the number of bits passing through the algorithms. The algorithms take input in the format of an unsigned character array of fixed size (8 or 16 characters depending on the algorithm). My initial solution was to count the number of characters passing though the algorithm and take this as the number of bytes. The bytes multiplied by 8 would then presumably be the bit count, however I've read that a character is not necessarily always an 8 bit byte. A discrepancy in the bit count could significantly skew results.
How exactly would I obtain the number of bits in an unsigned char array? (Or the number of bits of a single char element in that array).