void SolitaireCrypto::keydeck() {
	resetDeck();
	for(uint8_t i=0;i<passkey.length();i++) {
		solitaire();
		countcut(charCodeAt(passkey[i])-64);
	}
}
void SolitaireCrypto::keygen(unsigned int msgLen) {
	keystream.assign("");
	for(unsigned int k=0; k< msgLen; k++) {
        solitaire();
		if(output()<53) {
			keystream += fromCharCode(((output()-1)%26)+65);
		}
		if(output()>=53) {
			k--;
		}
	}
}
Esempio n. 3
0
static void game_select(char *name)
{
    printf("\n");

    char *game = malloc(strlen(name) + 1);
    strcpy(game, name);
    str_tolower(game);                      /* Ignore case when launching game */
    
    if (strcmp(game, games[0]) == 0)
        war();
    else if (strcmp(game, games[1]) == 0)
        solitaire();
    else
        printf("Not a valid game.\n");

    free(game);
}