Example #1
0
char *encipher(const char *plaintext){
	char *ciphertext = malloc(strlen(plaintext) + 1);
	if(ciphertext == NULL)
		return NULL;
	// Apply cipher
	unsigned i;
	for(i = 0; i < strlen(plaintext); i++){
		// Only substitute alphabetic chars
		if(isalpha(plaintext[i])){
			// Work out the correct character from the cipher to use
			ciphertext[i] = lookupChar(plaintext[i]);
		} else {
			ciphertext[i] = plaintext[i];
		}
	}
	
	ciphertext[i] = '\0';
	
	return ciphertext;
}
Example #2
0
void Display::showText(const char* text) {
    showRaw(lookupChar(text[0]), lookupChar(text[1]));
}