tweaked comments and includes
This commit is contained in:
parent
7fe3d3c107
commit
738bd9a99c
@ -29,10 +29,7 @@ int main()
|
|||||||
fgets(buf, 3, stdin);
|
fgets(buf, 3, stdin);
|
||||||
int choice = strtol(buf, NULL, 10);
|
int choice = strtol(buf, NULL, 10);
|
||||||
|
|
||||||
//char* msg = calloc(128, sizeof(char));
|
|
||||||
|
|
||||||
fputs("Enter your message text: ", stdout);
|
fputs("Enter your message text: ", stdout);
|
||||||
//if (msg) fgets(msg, 128, stdin);
|
|
||||||
char* msg = dyninput_str(INT64_MAX);
|
char* msg = dyninput_str(INT64_MAX);
|
||||||
|
|
||||||
fputs("Enter your key (shift value): ", stdout);
|
fputs("Enter your key (shift value): ", stdout);
|
||||||
|
11
src/crypt.c
11
src/crypt.c
@ -12,6 +12,12 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For built in C mod operator (%) -1 % 26 == -1
|
||||||
|
* For the requirements of this algorithm -1 mod 26 == 25 is required
|
||||||
|
* The below functions accomplish this
|
||||||
|
*/
|
||||||
|
|
||||||
// Which of the two below functions is faster (find out!)
|
// Which of the two below functions is faster (find out!)
|
||||||
inline int mod(int a, int b)
|
inline int mod(int a, int b)
|
||||||
{
|
{
|
||||||
@ -26,6 +32,11 @@ inline int fast_mod(int a, int b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 65 - 90 = ASCII 'A' - 'Z'
|
||||||
|
* 97 - 122 = ASCII 'a' - 'z'
|
||||||
|
*/
|
||||||
|
|
||||||
inline bool isupper(char c)
|
inline bool isupper(char c)
|
||||||
{
|
{
|
||||||
return c >= 'A' && c <= 'Z';
|
return c >= 'A' && c <= 'Z';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user