Document nmscharset module

modified:   src/nmscharset.c
This commit is contained in:
Brian Barto 2017-01-20 13:47:34 -05:00
parent a0d80ddb19
commit 08957b766c

View File

@ -4,10 +4,16 @@
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the MIT License. See LICENSE for more details. * under the terms of the MIT License. See LICENSE for more details.
*/ */
/*
* The nmscharset module defines the character set that is used to
* represent encryption.
*/
#include <stdlib.h> #include <stdlib.h>
#define MASK_CHAR_COUNT 218 // Total characters in charTable[] array. // Total characters in charTable[] array.
#define CHAR_COUNT 218
// Character table representing the character set know as CP437 used by // Character table representing the character set know as CP437 used by
// the original IBM PC - https://en.wikipedia.org/wiki/Code_page_437 // the original IBM PC - https://en.wikipedia.org/wiki/Code_page_437
@ -48,6 +54,9 @@ static char *charTable[] = {
"\xe2\x81\xbf", "\xe2\x96\xa0" "\xe2\x81\xbf", "\xe2\x96\xa0"
}; };
/*
* Return a random character from charTable[].
*/
char *nmscharset_get_random(void) { char *nmscharset_get_random(void) {
return charTable[rand() % MASK_CHAR_COUNT]; return charTable[rand() % CHAR_COUNT];
} }