Whitespaces.

This commit is contained in:
King_DuckZ 2014-09-25 19:06:38 +02:00
parent 322f21733f
commit 15e9c905f3
2 changed files with 29 additions and 29 deletions

View file

@ -4,7 +4,7 @@
* available on the official Tiger algorithm page. * available on the official Tiger algorithm page.
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
* the algorithm authorsip notice, this list of conditions and the following * the algorithm authorsip notice, this list of conditions and the following
* disclaimer. * disclaimer.
@ -15,7 +15,7 @@
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* 4. If this license is not appropriate for you please write me at * 4. If this license is not appropriate for you please write me at
* klondike ( a t ) klondike ( d o t ) es to negotiate another license. * klondike ( a t ) klondike ( d o t ) es to negotiate another license.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
@ -619,7 +619,7 @@ for (j = 0; j < 3; j++) {\
uc(res2+j)[7-k] = swp2;\ uc(res2+j)[7-k] = swp2;\
}\ }\
} }
#else #else
#define endianvars #define endianvars
#define endianvars_2 #define endianvars_2
@ -637,7 +637,7 @@ void tiger(const char *str, t_word length, t_res res)
res[0]=0x0123456789ABCDEFULL; res[0]=0x0123456789ABCDEFULL;
res[1]=0xFEDCBA9876543210ULL; res[1]=0xFEDCBA9876543210ULL;
res[2]=0xF096A5B4C3B2E187ULL; res[2]=0xF096A5B4C3B2E187ULL;
while(str<end) while(str<end)
{ {
#ifdef USE_BIG_ENDIAN #ifdef USE_BIG_ENDIAN
@ -669,7 +669,7 @@ void tiger(const char *str, t_word length, t_res res)
memset(uc(tmp)+i,0,(size_t)((8-i)&7)); memset(uc(tmp)+i,0,(size_t)((8-i)&7));
i+=(8-i)&7; i+=(8-i)&7;
//Reorder the block so it uses propper endianism now //Reorder the block so it uses propper endianism now
//TODO: recode this so it copies the data and sets it in big endian //TODO: recode this so it copies the data and sets it in big endian
#ifdef USE_BIG_ENDIAN #ifdef USE_BIG_ENDIAN
for (j = 0; j < i; j+=8) { for (j = 0; j < i; j+=8) {
for (k = 0; k < 4; k++) { for (k = 0; k < 4; k++) {
@ -698,14 +698,14 @@ void tiger_2(const char *str1, const char *str2, t_word length, t_res res1, t_re
const char * end = str1 + (length&(-64)); const char * end = str1 + (length&(-64));
t_word i; t_word i;
endianvars_2; endianvars_2;
res1[0]=0x0123456789ABCDEFULL; res1[0]=0x0123456789ABCDEFULL;
res2[0]=0x0123456789ABCDEFULL; res2[0]=0x0123456789ABCDEFULL;
res1[1]=0xFEDCBA9876543210ULL; res1[1]=0xFEDCBA9876543210ULL;
res2[1]=0xFEDCBA9876543210ULL; res2[1]=0xFEDCBA9876543210ULL;
res1[2]=0xF096A5B4C3B2E187ULL; res1[2]=0xF096A5B4C3B2E187ULL;
res2[2]=0xF096A5B4C3B2E187ULL; res2[2]=0xF096A5B4C3B2E187ULL;
while(str1<end) while(str1<end)
{ {
#ifdef USE_BIG_ENDIAN #ifdef USE_BIG_ENDIAN
@ -777,14 +777,14 @@ void tiger_sse2(const char *str1, const char *str2, t_word length, t_res res1, t
t_block tmp2; t_block tmp2;
const char * end = str1 + (length&(-64)); const char * end = str1 + (length&(-64));
t_word i; t_word i;
res1[0]=0x0123456789ABCDEFULL; res1[0]=0x0123456789ABCDEFULL;
res2[0]=0x0123456789ABCDEFULL; res2[0]=0x0123456789ABCDEFULL;
res1[1]=0xFEDCBA9876543210ULL; res1[1]=0xFEDCBA9876543210ULL;
res2[1]=0xFEDCBA9876543210ULL; res2[1]=0xFEDCBA9876543210ULL;
res1[2]=0xF096A5B4C3B2E187ULL; res1[2]=0xF096A5B4C3B2E187ULL;
res2[2]=0xF096A5B4C3B2E187ULL; res2[2]=0xF096A5B4C3B2E187ULL;
while(str1<end) while(str1<end)
{ {
#ifdef FORCE_ALIGNMENT #ifdef FORCE_ALIGNMENT
@ -828,11 +828,11 @@ void tiger_49(const char *str, t_res res)
{ {
t_block tmp; t_block tmp;
endianvars; endianvars;
res[0]=0x0123456789ABCDEFULL; res[0]=0x0123456789ABCDEFULL;
res[1]=0xFEDCBA9876543210ULL; res[1]=0xFEDCBA9876543210ULL;
res[2]=0xF096A5B4C3B2E187ULL; res[2]=0xF096A5B4C3B2E187ULL;
#ifdef USE_BIG_ENDIAN #ifdef USE_BIG_ENDIAN
uc(tmp)[7]=0x01; uc(tmp)[7]=0x01;
for (k = 0; k < 7; k++) { for (k = 0; k < 7; k++) {
@ -869,11 +869,11 @@ void tiger_1025(const char *str, t_res res)
t_block tmp; t_block tmp;
const char *end=str+1023; const char *end=str+1023;
endianvars; endianvars;
res[0]=0x0123456789ABCDEFULL; res[0]=0x0123456789ABCDEFULL;
res[1]=0xFEDCBA9876543210ULL; res[1]=0xFEDCBA9876543210ULL;
res[2]=0xF096A5B4C3B2E187ULL; res[2]=0xF096A5B4C3B2E187ULL;
#ifdef USE_BIG_ENDIAN #ifdef USE_BIG_ENDIAN
uc(tmp)[7]=0x00; uc(tmp)[7]=0x00;
for (k = 0; k < 7; k++) { for (k = 0; k < 7; k++) {
@ -933,14 +933,14 @@ void tiger_2_49(const char *str1, const char *str2, t_res res1, t_res res2)
t_block tmp1; t_block tmp1;
t_block tmp2; t_block tmp2;
endianvars_2; endianvars_2;
res1[0]=0x0123456789ABCDEFULL; res1[0]=0x0123456789ABCDEFULL;
res2[0]=0x0123456789ABCDEFULL; res2[0]=0x0123456789ABCDEFULL;
res1[1]=0xFEDCBA9876543210ULL; res1[1]=0xFEDCBA9876543210ULL;
res2[1]=0xFEDCBA9876543210ULL; res2[1]=0xFEDCBA9876543210ULL;
res1[2]=0xF096A5B4C3B2E187ULL; res1[2]=0xF096A5B4C3B2E187ULL;
res2[2]=0xF096A5B4C3B2E187ULL; res2[2]=0xF096A5B4C3B2E187ULL;
#ifdef USE_BIG_ENDIAN #ifdef USE_BIG_ENDIAN
uc(tmp1)[7]=0x01; uc(tmp1)[7]=0x01;
uc(tmp2)[7]=0x01; uc(tmp2)[7]=0x01;
@ -996,7 +996,7 @@ void tiger_2_1025(const char *str1, const char *str2, t_res res1, t_res res2)
res2[1]=0xFEDCBA9876543210ULL; res2[1]=0xFEDCBA9876543210ULL;
res1[2]=0xF096A5B4C3B2E187ULL; res1[2]=0xF096A5B4C3B2E187ULL;
res2[2]=0xF096A5B4C3B2E187ULL; res2[2]=0xF096A5B4C3B2E187ULL;
#ifdef USE_BIG_ENDIAN #ifdef USE_BIG_ENDIAN
uc(tmp1)[7]=0x00; uc(tmp1)[7]=0x00;
uc(tmp2)[7]=0x00; uc(tmp2)[7]=0x00;
@ -1068,14 +1068,14 @@ void tiger_sse2_49(const char *str1, const char *str2, t_res res1, t_res res2)
{ {
t_block tmp1; t_block tmp1;
t_block tmp2; t_block tmp2;
res1[0]=0x0123456789ABCDEFULL; res1[0]=0x0123456789ABCDEFULL;
res2[0]=0x0123456789ABCDEFULL; res2[0]=0x0123456789ABCDEFULL;
res1[1]=0xFEDCBA9876543210ULL; res1[1]=0xFEDCBA9876543210ULL;
res2[1]=0xFEDCBA9876543210ULL; res2[1]=0xFEDCBA9876543210ULL;
res1[2]=0xF096A5B4C3B2E187ULL; res1[2]=0xF096A5B4C3B2E187ULL;
res2[2]=0xF096A5B4C3B2E187ULL; res2[2]=0xF096A5B4C3B2E187ULL;
*uc(tmp1)=0x01; *uc(tmp1)=0x01;
*uc(tmp2)=0x01; *uc(tmp2)=0x01;
memcpy(uc(tmp1)+1,str1,47); memcpy(uc(tmp1)+1,str1,47);
@ -1096,14 +1096,14 @@ void tiger_sse2_1025(const char *str1, const char *str2, t_res res1, t_res res2)
t_block tmp1; t_block tmp1;
t_block tmp2; t_block tmp2;
const char *end=str1+1023; const char *end=str1+1023;
res1[0]=0x0123456789ABCDEFULL; res1[0]=0x0123456789ABCDEFULL;
res2[0]=0x0123456789ABCDEFULL; res2[0]=0x0123456789ABCDEFULL;
res1[1]=0xFEDCBA9876543210ULL; res1[1]=0xFEDCBA9876543210ULL;
res2[1]=0xFEDCBA9876543210ULL; res2[1]=0xFEDCBA9876543210ULL;
res1[2]=0xF096A5B4C3B2E187ULL; res1[2]=0xF096A5B4C3B2E187ULL;
res2[2]=0xF096A5B4C3B2E187ULL; res2[2]=0xF096A5B4C3B2E187ULL;
*uc(tmp1)=0x00; *uc(tmp1)=0x00;
*uc(tmp2)=0x00; *uc(tmp2)=0x00;
memcpy(uc(tmp1)+1,str1,63); memcpy(uc(tmp1)+1,str1,63);
@ -1144,12 +1144,12 @@ void tigerp1(const char *password, t_word length, const char *salt, t_pres *pres
res[0]=0x0123456789ABCDEFULL; res[0]=0x0123456789ABCDEFULL;
res[1]=0xFEDCBA9876543210ULL; res[1]=0xFEDCBA9876543210ULL;
res[2]=0xF096A5B4C3B2E187ULL; res[2]=0xF096A5B4C3B2E187ULL;
//Initialize the presult salt //Initialize the presult salt
memcpy(pres->r,salt,128); memcpy(pres->r,salt,128);
pres->n = 0; pres->n = 0;
pres->hs = length; pres->hs = length;
while(password<end) while(password<end)
{ {
#ifdef USE_BIG_ENDIAN #ifdef USE_BIG_ENDIAN
@ -1216,18 +1216,18 @@ void tigerp2(const t_pres *pres, const char *salt, t_word length, t_res res)
const char * end = salt + length; const char * end = salt + length;
t_word i; t_word i;
endianvars; endianvars;
memcpy(res, pres->h, 24); memcpy(res, pres->h, 24);
//Reorder the result so it is shown in propper endian //Reorder the result so it is shown in propper endian
fixresendian; fixresendian;
//Append any remaining psalt character //Append any remaining psalt character
i=128 - pres->n; i=128 - pres->n;
memcpy(tmp,pres->r+pres->n,i); memcpy(tmp,pres->r+pres->n,i);
while (i != 64 && salt != end) { while (i != 64 && salt != end) {
uc(tmp)[i++] = *salt++; uc(tmp)[i++] = *salt++;
} }
if ( i == 64) { if ( i == 64) {
#ifdef USE_BIG_ENDIAN #ifdef USE_BIG_ENDIAN
for (j = 0; j < 8; j++) { for (j = 0; j < 8; j++) {
@ -1274,7 +1274,7 @@ void tigerp2(const t_pres *pres, const char *salt, t_word length, t_res res)
memset(uc(tmp)+i,0,(size_t)((8-i)&7)); memset(uc(tmp)+i,0,(size_t)((8-i)&7));
i+=(8-i)&7; i+=(8-i)&7;
//Reorder the block so it uses propper endianism now //Reorder the block so it uses propper endianism now
//TODO: recode this so it copies the data and sets it in big endian //TODO: recode this so it copies the data and sets it in big endian
#ifdef USE_BIG_ENDIAN #ifdef USE_BIG_ENDIAN
for (j = 0; j < i; j+=8) { for (j = 0; j < i; j+=8) {
for (k = 0; k < 4; k++) { for (k = 0; k < 4; k++) {
@ -1294,4 +1294,4 @@ void tigerp2(const t_pres *pres, const char *salt, t_word length, t_res res)
tiger_block(tmp, res); tiger_block(tmp, res);
//Finally we reorder the result so it is shown in little endian //Finally we reorder the result so it is shown in little endian
fixresendian; fixresendian;
} }

View file

@ -4,7 +4,7 @@
* available on the official Tiger algorithm page. * available on the official Tiger algorithm page.
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
* the algorithm authorsip notice, this list of conditions and the following * the algorithm authorsip notice, this list of conditions and the following
* disclaimer. * disclaimer.
@ -15,7 +15,7 @@
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* 4. If this license is not appropriate for you please write me at * 4. If this license is not appropriate for you please write me at
* klondike ( a t ) klondike ( d o t ) es to negotiate another license. * klondike ( a t ) klondike ( d o t ) es to negotiate another license.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO