Anonymous user
The ISAAC cipher: Difference between revisions
→{{header|C}}: Make C code work on 64-bit machines, and fix pointers to local stack
(→{{header|C}}: Implemented task's complete solution (ie. added MOD section)) |
(→{{header|C}}: Make C code work on 64-bit machines, and fix pointers to local stack) |
||
Line 49:
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#ifdef _MSC_VER
typedef unsigned __int32 uint32_t;
#else
#include <stdint.h>
#endif
/* a ub4 is an unsigned 4-byte quantity */
typedef
/* external results */
Line 186 ⟶ 192:
// XOR cipher on random stream. Output: ASCII string
char* Vernam(char *msg)
{
register ub4 i,l;
l = strlen(msg);
▲ char v[MAXMSG];
// zeroise v
memset(v,'\0',l+1);
Line 212 ⟶ 218:
// Caesar-shift a string on a pseudo-random stream
char* CaesarStr(enum ciphermode m, char *msg, char modulo, char start)
{
register ub4 i,l;
l = strlen(msg);
▲ char c[MAXMSG];
// zeroise c
memset(c,'\0',l+1);
|