int main(int argc, char *argv[]) { Matrix* myMatrix; char *input = NULL; char *output = NULL; if(argc == 3) { // generate matrix from file myMatrix = assignMatrixFromFile(argv[1]); // look for some zeroes printMatrix(myMatrix); // collect message from file input = collectABC(argv[2]); padMessage(&input, myMatrix); // encipher the text output = encipherText(input, myMatrix); // echo message to screen printMessage(input); printMessage(output); } else { printf("You must enter the names of 2 files.\n"); } }
/* * SHA1Result * * Description: * This function will return the 160-bit message digest into the * Message_Digest array provided by the caller. * NOTE: The first octet of hash is stored in the 0th element, * the last octet of hash in the 19th element. * * Parameters: * context: [in/out] * The context to use to calculate the SHA-1 hash. * Message_Digest: [out] * Where the digest is returned. * * Returns: * sha Error Code. * */ int SHA::getResult(const uint8_t* data, xdl_uint length, uint8_t* Message_Digest) { reset(); setInput( data, length); int i; if (Corrupted) { return Corrupted; } if (!Computed) { padMessage(); for (i=0; i<64; ++i) { /* message may be sensitive, clear it out */ Message_Block[i] = 0; } Length_Low = 0; /* and clear length */ Length_High = 0; Computed = 1; } for (i = 0; i < SHA1HashSize; ++i) { Message_Digest[i] = Intermediate_Hash[i>>2] >> 8 * ( 3 - ( i & 0x03 ) ); } return shaSuccess; }