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 unsigned long intuint32_t ub4;
 
/* external results */
Line 186 ⟶ 192:
 
// XOR cipher on random stream. Output: ASCII string
char v[MAXMSG];
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 c[MAXMSG];
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);
Anonymous user