Modified:
/src/shacrypt.c
=======================================
--- /src/shacrypt.c Sat Mar 13 07:26:35 2010
+++ /src/shacrypt.c Sat Mar 13 07:33:04 2010
@@ -417,99 +417,99 @@
c = 0;
if ( ctx->algos & '\x01' ) {
- if ( ctx->shuffle_sha1_ptr > 19 ) {
- ctx->shuffle_sha1_ptr = 0;
- SHA1Reset( &ctx->shuffle_sha1 );
- SHA1Input( &ctx->shuffle_sha1, ctx->shuffle_sha1_res, 20 );
- SHA1Input( &ctx->shuffle_sha1, ctx->shufflekey,
ctx->shufflelen );
- SHA1Result( &ctx->shuffle_sha1, ctx->shuffle_sha1_res );
- }
- c ^= shuffle_ctx->sha1_res[ctx->shuffle_sha1_ptr];
- ctx->shuffle_sha1_ptr++;
+ if ( ctx->scramble_sha1_ptr > 19 ) {
+ ctx->scramble_sha1_ptr = 0;
+ SHA1Reset( &ctx->scramble_sha1 );
+ SHA1Input( &ctx->scramble_sha1, ctx->scramble_sha1_res, 20
);
+ SHA1Input( &ctx->scramble_sha1, ctx->shufflekey,
ctx->shufflelen );
+ SHA1Result( &ctx->scramble_sha1, ctx->scramble_sha1_res );
+ }
+ c ^= scramble_ctx->sha1_res[ctx->scramble_sha1_ptr];
+ ctx->scramble_sha1_ptr++;
}
if ( ctx->algos & '\x02' ) {
- if ( ctx->shuffle_sha224_ptr > 27 ) {
- ctx->shuffle_sha224_ptr = 0;
- sha224_init( &ctx->shuffle_sha224 );
- sha224_update( &ctx->shuffle_sha224,
ctx->shuffle_sha224_res, 28 );
- sha224_update( &ctx->shuffle_sha224, ctx->shufflekey,
ctx->shufflelen );
- sha224_final( &ctx->shuffle_sha224,
ctx->shuffle_sha224_res );
- }
- c ^= ctx->shuffle_sha224_res[ctx->shuffle_sha224_ptr];
- ctx->shuffle_sha224_ptr++;
+ if ( ctx->scramble_sha224_ptr > 27 ) {
+ ctx->scramble_sha224_ptr = 0;
+ sha224_init( &ctx->scramble_sha224 );
+ sha224_update( &ctx->scramble_sha224,
ctx->scramble_sha224_res, 28 );
+ sha224_update( &ctx->scramble_sha224, ctx->shufflekey,
ctx->shufflelen );
+ sha224_final( &ctx->scramble_sha224,
ctx->scramble_sha224_res );
+ }
+ c ^= ctx->scramble_sha224_res[ctx->scramble_sha224_ptr];
+ ctx->scramble_sha224_ptr++;
}
if ( ctx->algos & '\x04' ) {
- if ( ctx->shuffle_sha256_ptr > 31 ) {
- ctx->shuffle_sha256_ptr = 0;
- sha256_init( &ctx->shuffle_sha256 );
- sha256_update( &ctx->shuffle_sha256,
ctx->shuffle_sha256_res, 32 );
- sha256_update( &ctx->shuffle_sha256, ctx->shufflekey,
ctx->shufflelen );
- sha256_final( &ctx->shuffle_sha256,
ctx->shuffle_sha256_res );
- }
- c ^= ctx->shuffle_sha256_res[ctx->shuffle_sha256_ptr];
- ctx->shuffle_sha256_ptr++;
+ if ( ctx->scramble_sha256_ptr > 31 ) {
+ ctx->scramble_sha256_ptr = 0;
+ sha256_init( &ctx->scramble_sha256 );
+ sha256_update( &ctx->scramble_sha256,
ctx->scramble_sha256_res, 32 );
+ sha256_update( &ctx->scramble_sha256, ctx->shufflekey,
ctx->shufflelen );
+ sha256_final( &ctx->scramble_sha256,
ctx->scramble_sha256_res );
+ }
+ c ^= ctx->scramble_sha256_res[ctx->scramble_sha256_ptr];
+ ctx->scramble_sha256_ptr++;
}
if ( ctx->algos & '\x08' ) {
- if ( ctx->shuffle_sha384_ptr > 47 ) {
- ctx->shuffle_sha384_ptr = 0;
- sha384_init( &ctx->shuffle_sha384 );
- sha384_update( &ctx->shuffle_sha384,
ctx->shuffle_sha384_res, 48 );
- sha384_update( &ctx->shuffle_sha384, ctx->shufflekey,
ctx->shufflelen );
- sha384_final( &ctx->shuffle_sha384,
ctx->shuffle_sha384_res );
- }
- c ^= ctx->shuffle_sha384_res[ctx->shuffle_sha384_ptr];
- ctx->shuffle_sha384_ptr++;
+ if ( ctx->scramble_sha384_ptr > 47 ) {
+ ctx->scramble_sha384_ptr = 0;
+ sha384_init( &ctx->scramble_sha384 );
+ sha384_update( &ctx->scramble_sha384,
ctx->scramble_sha384_res, 48 );
+ sha384_update( &ctx->scramble_sha384, ctx->shufflekey,
ctx->shufflelen );
+ sha384_final( &ctx->scramble_sha384,
ctx->scramble_sha384_res );
+ }
+ c ^= ctx->scramble_sha384_res[ctx->scramble_sha384_ptr];
+ ctx->scramble_sha384_ptr++;
}
if ( ctx->algos & '\x10' ) {
- if ( ctx->shuffle_sha512_ptr > 63 ) {
- ctx->shuffle_sha512_ptr = 0;
- sha512_init( &ctx->shuffle_sha512 );
- sha512_update( &ctx->shuffle_sha512,
ctx->shuffle_sha512_res, 64 );
- sha512_update( &ctx->shuffle_sha512, ctx->shufflekey,
ctx->shufflelen );
- sha512_final( &ctx->shuffle_sha512,
ctx->shuffle_sha512_res );
- }
- c ^= ctx->shuffle_sha512_res[ctx->shuffle_sha512_ptr];
- ctx->shuffle_sha512_ptr++;
+ if ( ctx->scramble_sha512_ptr > 63 ) {
+ ctx->scramble_sha512_ptr = 0;
+ sha512_init( &ctx->scramble_sha512 );
+ sha512_update( &ctx->scramble_sha512,
ctx->scramble_sha512_res, 64 );
+ sha512_update( &ctx->scramble_sha512, ctx->shufflekey,
ctx->shufflelen );
+ sha512_final( &ctx->scramble_sha512,
ctx->scramble_sha512_res );
+ }
+ c ^= ctx->scramble_sha512_res[ctx->scramble_sha512_ptr];
+ ctx->scramble_sha512_ptr++;
}
if ( ctx->algos & '\x20' ) {
- if ( ctx->shuffle_md5_ptr > 15 ) {
- ctx->shuffle_md5_ptr = 0;
- MD5Init( &ctx->shuffle_md5 );
- MD5Update( &ctx->shuffle_md5, ctx->shuffle_md5_res, 16 );
- MD5Update( &ctx->shuffle_md5, ctx->shufflekey,
ctx->shufflelen );
- MD5Final( ctx->shuffle_md5_res, &ctx->shuffle_md5 );
- }
- c ^= ctx->shuffle_md5_res[ctx->shuffle_md5_ptr];
- ctx->shuffle_md5_ptr++;
+ if ( ctx->scramble_md5_ptr > 15 ) {
+ ctx->scramble_md5_ptr = 0;
+ MD5Init( &ctx->scramble_md5 );
+ MD5Update( &ctx->scramble_md5, ctx->scramble_md5_res, 16 );
+ MD5Update( &ctx->scramble_md5, ctx->shufflekey,
ctx->shufflelen );
+ MD5Final( ctx->scramble_md5_res, &ctx->scramble_md5 );
+ }
+ c ^= ctx->scramble_md5_res[ctx->scramble_md5_ptr];
+ ctx->scramble_md5_ptr++;
}
if ( ctx->algos & '\x40' ) {
- if ( ctx->shuffle_cube_ptr > 63 ) {
- ctx->shuffle_cube_ptr = 0;
- CubeHash_Init( &ctx->shuffle_cube, 512 );
- CubeHash_Update( &ctx->shuffle_cube,
ctx->shuffle_cube_res, 512 );
- CubeHash_Update( &ctx->shuffle_cube, ctx->shufflekey,
(int)ctx->shufflelen << 3 );
- CubeHash_Final( &ctx->shuffle_cube, ctx->shuffle_cube_res
);
- }
- c ^= ctx->shuffle_cube_res[ctx->shuffle_cube_ptr];
- ctx->shuffle_cube_ptr++;
+ if ( ctx->scramble_cube_ptr > 63 ) {
+ ctx->scramble_cube_ptr = 0;
+ CubeHash_Init( &ctx->scramble_cube, 512 );
+ CubeHash_Update( &ctx->scramble_cube,
ctx->scramble_cube_res, 512 );
+ CubeHash_Update( &ctx->scramble_cube, ctx->shufflekey,
(int)ctx->shufflelen << 3 );
+ CubeHash_Final( &ctx->scramble_cube,
ctx->scramble_cube_res );
+ }
+ c ^= ctx->scramble_cube_res[ctx->scramble_cube_ptr];
+ ctx->scramble_cube_ptr++;
}
if ( ctx->algos & '\x80' ) {
- if ( ctx->shuffle_whirlpool_ptr > 63 ) {
- ctx->shuffle_whirlpool_ptr = 0;
- NESSIEinit( &ctx->shuffle_whirlpool );
- NESSIEadd( ctx->shuffle_whirlpool_res, 512,
&ctx->shuffle_whirlpool );
- NESSIEadd( ctx->shufflekey, (int)ctx->shufflelen << 3,
&ctx->shuffle_whirlpool );
- NESSIEfinalize( &ctx->shuffle_whirlpool,
ctx->shuffle_whirlpool_res );
- }
- c ^= ctx->shuffle_whirlpool_res[ctx->shuffle_whirlpool_ptr];
- ctx->shuffle_whirlpool_ptr++;
+ if ( ctx->scramble_whirlpool_ptr > 63 ) {
+ ctx->scramble_whirlpool_ptr = 0;
+ NESSIEinit( &ctx->scramble_whirlpool );
+ NESSIEadd( ctx->scramble_whirlpool_res, 512,
&ctx->scramble_whirlpool );
+ NESSIEadd( ctx->shufflekey, (int)ctx->shufflelen << 3,
&ctx->scramble_whirlpool );
+ NESSIEfinalize( &ctx->scramble_whirlpool,
ctx->scramble_whirlpool_res );
+ }
+ c ^= ctx->scramble_whirlpool_res[ctx->scramble_whirlpool_ptr];
+ ctx->scramble_whirlpool_ptr++;
}
out[c % len] ^= out[i];
@@ -536,99 +536,99 @@
c = 0;
if ( ctx->algos & '\x01' ) {
- if ( ctx->shuffle_sha1_ptr > 19 ) {
- ctx->shuffle_sha1_ptr = 0;
- SHA1Reset( &ctx->shuffle_sha1 );
- SHA1Input( &ctx->shuffle_sha1, ctx->shuffle_sha1_res, 20 );
- SHA1Input( &ctx->shuffle_sha1, ctx->shufflekey,
ctx->shufflelen );
- SHA1Result( &ctx->shuffle_sha1, ctx->shuffle_sha1_res );
- }
- c ^= shuffle_ctx->sha1_res[ctx->shuffle_sha1_ptr];
- ctx->shuffle_sha1_ptr++;
+ if ( ctx->scramble_sha1_ptr > 19 ) {
+ ctx->scramble_sha1_ptr = 0;
+ SHA1Reset( &ctx->scramble_sha1 );
+ SHA1Input( &ctx->scramble_sha1, ctx->scramble_sha1_res, 20
);
+ SHA1Input( &ctx->scramble_sha1, ctx->shufflekey,
ctx->shufflelen );
+ SHA1Result( &ctx->scramble_sha1, ctx->scramble_sha1_res );
+ }
+ c ^= scramble_ctx->sha1_res[ctx->scramble_sha1_ptr];
+ ctx->scramble_sha1_ptr++;
}
if ( ctx->algos & '\x02' ) {
- if ( ctx->shuffle_sha224_ptr > 27 ) {
- ctx->shuffle_sha224_ptr = 0;
- sha224_init( &ctx->shuffle_sha224 );
- sha224_update( &ctx->shuffle_sha224,
ctx->shuffle_sha224_res, 28 );
- sha224_update( &ctx->shuffle_sha224, ctx->shufflekey,
ctx->shufflelen );
- sha224_final( &ctx->shuffle_sha224,
ctx->shuffle_sha224_res );
- }
- c ^= ctx->shuffle_sha224_res[ctx->shuffle_sha224_ptr];
- ctx->shuffle_sha224_ptr++;
+ if ( ctx->scramble_sha224_ptr > 27 ) {
+ ctx->scramble_sha224_ptr = 0;
+ sha224_init( &ctx->scramble_sha224 );
+ sha224_update( &ctx->scramble_sha224,
ctx->scramble_sha224_res, 28 );
+ sha224_update( &ctx->scramble_sha224, ctx->shufflekey,
ctx->shufflelen );
+ sha224_final( &ctx->scramble_sha224,
ctx->scramble_sha224_res );
+ }
+ c ^= ctx->scramble_sha224_res[ctx->scramble_sha224_ptr];
+ ctx->scramble_sha224_ptr++;
}
if ( ctx->algos & '\x04' ) {
- if ( ctx->shuffle_sha256_ptr > 31 ) {
- ctx->shuffle_sha256_ptr = 0;
- sha256_init( &ctx->shuffle_sha256 );
- sha256_update( &ctx->shuffle_sha256,
ctx->shuffle_sha256_res, 32 );
- sha256_update( &ctx->shuffle_sha256, ctx->shufflekey,
ctx->shufflelen );
- sha256_final( &ctx->shuffle_sha256,
ctx->shuffle_sha256_res );
- }
- c ^= ctx->shuffle_sha256_res[ctx->shuffle_sha256_ptr];
- ctx->shuffle_sha256_ptr++;
+ if ( ctx->scramble_sha256_ptr > 31 ) {
+ ctx->scramble_sha256_ptr = 0;
+ sha256_init( &ctx->scramble_sha256 );
+ sha256_update( &ctx->scramble_sha256,
ctx->scramble_sha256_res, 32 );
+ sha256_update( &ctx->scramble_sha256, ctx->shufflekey,
ctx->shufflelen );
+ sha256_final( &ctx->scramble_sha256,
ctx->scramble_sha256_res );
+ }
+ c ^= ctx->scramble_sha256_res[ctx->scramble_sha256_ptr];
+ ctx->scramble_sha256_ptr++;
}
if ( ctx->algos & '\x08' ) {
- if ( ctx->shuffle_sha384_ptr > 47 ) {
- ctx->shuffle_sha384_ptr = 0;
- sha384_init( &ctx->shuffle_sha384 );
- sha384_update( &ctx->shuffle_sha384,
ctx->shuffle_sha384_res, 48 );
- sha384_update( &ctx->shuffle_sha384, ctx->shufflekey,
ctx->shufflelen );
- sha384_final( &ctx->shuffle_sha384,
ctx->shuffle_sha384_res );
- }
- c ^= ctx->shuffle_sha384_res[ctx->shuffle_sha384_ptr];
- ctx->shuffle_sha384_ptr++;
+ if ( ctx->scramble_sha384_ptr > 47 ) {
+ ctx->scramble_sha384_ptr = 0;
+ sha384_init( &ctx->scramble_sha384 );
+ sha384_update( &ctx->scramble_sha384,
ctx->scramble_sha384_res, 48 );
+ sha384_update( &ctx->scramble_sha384, ctx->shufflekey,
ctx->shufflelen );
+ sha384_final( &ctx->scramble_sha384,
ctx->scramble_sha384_res );
+ }
+ c ^= ctx->scramble_sha384_res[ctx->scramble_sha384_ptr];
+ ctx->scramble_sha384_ptr++;
}
if ( ctx->algos & '\x10' ) {
- if ( ctx->shuffle_sha512_ptr > 63 ) {
- ctx->shuffle_sha512_ptr = 0;
- sha512_init( &ctx->shuffle_sha512 );
- sha512_update( &ctx->shuffle_sha512,
ctx->shuffle_sha512_res, 64 );
- sha512_update( &ctx->shuffle_sha512, ctx->shufflekey,
ctx->shufflelen );
- sha512_final( &ctx->shuffle_sha512,
ctx->shuffle_sha512_res );
- }
- c ^= ctx->shuffle_sha512_res[ctx->shuffle_sha512_ptr];
- ctx->shuffle_sha512_ptr++;
+ if ( ctx->scramble_sha512_ptr > 63 ) {
+ ctx->scramble_sha512_ptr = 0;
+ sha512_init( &ctx->scramble_sha512 );
+ sha512_update( &ctx->scramble_sha512,
ctx->scramble_sha512_res, 64 );
+ sha512_update( &ctx->scramble_sha512, ctx->shufflekey,
ctx->shufflelen );
+ sha512_final( &ctx->scramble_sha512,
ctx->scramble_sha512_res );
+ }
+ c ^= ctx->scramble_sha512_res[ctx->scramble_sha512_ptr];
+ ctx->scramble_sha512_ptr++;
}
if ( ctx->algos & '\x20' ) {
- if ( ctx->shuffle_md5_ptr > 15 ) {
- ctx->shuffle_md5_ptr = 0;
- MD5Init( &ctx->shuffle_md5 );
- MD5Update( &ctx->shuffle_md5, ctx->shuffle_md5_res, 16 );
- MD5Update( &ctx->shuffle_md5, ctx->shufflekey,
ctx->shufflelen );
- MD5Final( ctx->shuffle_md5_res, &ctx->shuffle_md5 );
- }
- c ^= ctx->shuffle_md5_res[ctx->shuffle_md5_ptr];
- ctx->shuffle_md5_ptr++;
+ if ( ctx->scramble_md5_ptr > 15 ) {
+ ctx->scramble_md5_ptr = 0;
+ MD5Init( &ctx->scramble_md5 );
+ MD5Update( &ctx->scramble_md5, ctx->scramble_md5_res, 16 );
+ MD5Update( &ctx->scramble_md5, ctx->shufflekey,
ctx->shufflelen );
+ MD5Final( ctx->scramble_md5_res, &ctx->scramble_md5 );
+ }
+ c ^= ctx->scramble_md5_res[ctx->scramble_md5_ptr];
+ ctx->scramble_md5_ptr++;
}
if ( ctx->algos & '\x40' ) {
- if ( ctx->shuffle_cube_ptr > 63 ) {
- ctx->shuffle_cube_ptr = 0;
- CubeHash_Init( &ctx->shuffle_cube, 512 );
- CubeHash_Update( &ctx->shuffle_cube,
ctx->shuffle_cube_res, 512 );
- CubeHash_Update( &ctx->shuffle_cube, ctx->shufflekey,
(int)ctx->shufflelen << 3 );
- CubeHash_Final( &ctx->shuffle_cube, ctx->shuffle_cube_res
);
- }
- c ^= ctx->shuffle_cube_res[ctx->shuffle_cube_ptr];
- ctx->shuffle_cube_ptr++;
+ if ( ctx->scramble_cube_ptr > 63 ) {
+ ctx->scramble_cube_ptr = 0;
+ CubeHash_Init( &ctx->scramble_cube, 512 );
+ CubeHash_Update( &ctx->scramble_cube,
ctx->scramble_cube_res, 512 );
+ CubeHash_Update( &ctx->scramble_cube, ctx->shufflekey,
(int)ctx->shufflelen << 3 );
+ CubeHash_Final( &ctx->scramble_cube,
ctx->scramble_cube_res );
+ }
+ c ^= ctx->scramble_cube_res[ctx->scramble_cube_ptr];
+ ctx->scramble_cube_ptr++;
}
if ( ctx->algos & '\x80' ) {
- if ( ctx->shuffle_whirlpool_ptr > 63 ) {
- ctx->shuffle_whirlpool_ptr = 0;
- NESSIEinit( &ctx->shuffle_whirlpool );
- NESSIEadd( ctx->shuffle_whirlpool_res, 512,
&ctx->shuffle_whirlpool );
- NESSIEadd( ctx->shufflekey, (int)ctx->shufflelen << 3,
&ctx->shuffle_whirlpool );
- NESSIEfinalize( &ctx->shuffle_whirlpool,
ctx->shuffle_whirlpool_res );
- }
- c ^= ctx->shuffle_whirlpool_res[ctx->shuffle_whirlpool_ptr];
- ctx->shuffle_whirlpool_ptr++;
+ if ( ctx->scramble_whirlpool_ptr > 63 ) {
+ ctx->scramble_whirlpool_ptr = 0;
+ NESSIEinit( &ctx->scramble_whirlpool );
+ NESSIEadd( ctx->scramble_whirlpool_res, 512,
&ctx->scramble_whirlpool );
+ NESSIEadd( ctx->shufflekey, (int)ctx->shufflelen << 3,
&ctx->scramble_whirlpool );
+ NESSIEfinalize( &ctx->scramble_whirlpool,
ctx->scramble_whirlpool_res );
+ }
+ c ^= ctx->scramble_whirlpool_res[ctx->scramble_whirlpool_ptr];
+ ctx->scramble_whirlpool_ptr++;
}
out[c % len] ^= out[i];