Skip to content

Commit 25105c0

Browse files
committed
Use spaces instead of tabs and fix EOL whitespace
1 parent 3c784bf commit 25105c0

31 files changed

Lines changed: 2808 additions & 2808 deletions

configure.ac

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@ AC_TRY_RUN([
2121
#include <sys/types.h>
2222
int main()
2323
{
24-
uint16_t s = 1;
25-
uint16_t* ptr = &s;
26-
uint8_t n = *((uint8_t*)ptr);
27-
return n;
24+
uint16_t s = 1;
25+
uint16_t* ptr = &s;
26+
uint8_t n = *((uint8_t*)ptr);
27+
return n;
2828
}
2929
3030
]
3131
, AC_DEFINE([BIGENDIAN], [1], [Define to 1 if system is big endian])
3232
[echo "big"]
3333
, AC_DEFINE([LITTLEENDIAN], [1], [Define to 1 if system is little endian])
34-
[echo "little"]
34+
[echo "little"]
3535
)
3636

3737
AC_CONFIG_HEADERS([config.h])
3838
AC_CONFIG_FILES([
39-
Makefile
40-
src/Makefile
39+
Makefile
40+
src/Makefile
4141
])
4242

4343
AC_OUTPUT

source_dist.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ rm -fr $PKGDIR
77
mkdir $PKGDIR
88

99
for b in config configure doc product_version src support tests vb6_example \
10-
vc7_build vc8_build windows_dist.bat source_dist.sh windows_dist.sh \
11-
README-Windows.txt
10+
vc7_build vc8_build windows_dist.bat source_dist.sh windows_dist.sh \
11+
README-Windows.txt
1212
do
13-
cp -R $SCRIPT_PATH/$b $PKGDIR
13+
cp -R $SCRIPT_PATH/$b $PKGDIR
1414
done
1515

1616
rm -f $PKGDIR.tar.bz2

src/bncsutil/bsha1.cpp

Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <bncsutil/bsha1.h>
2828
#include <cstring>
2929

30-
#define USE_NEW_BSHA1 0
30+
#define USE_NEW_BSHA1 0
3131

3232
#define BSHA_IC1 0x67452301lu
3333
#define BSHA_IC2 0xEFCDAB89lu
@@ -41,10 +41,10 @@
4141
#define BSHA_OC4 0x359D3E2Alu
4242

4343
#if !USE_NEW_BSHA1
44-
# define BSHA_COP e = d; d = c; c = ROL(b, 30); b = a; a = g;
44+
# define BSHA_COP e = d; d = c; c = ROL(b, 30); b = a; a = g;
4545
#else
46-
# define BSHA_N_COP t[4] = t[3]; t[3] = t[2]; t[2] = ROL(t[1], 30); \
47-
t[1] = t[0]; t[0] = x
46+
# define BSHA_N_COP t[4] = t[3]; t[3] = t[2]; t[2] = ROL(t[1], 30); \
47+
t[1] = t[0]; t[0] = x
4848
#endif
4949

5050
#if !USE_NEW_BSHA1
@@ -60,108 +60,108 @@
6060
#else
6161

6262
#define BSHA_N_OP1() x = LSB4(*p++) + ROL(t[0], 5) + t[4] + \
63-
((t[1] & t[2]) | (~t[1] & t[3])) + BSHA_OC1; BSHA_N_COP
63+
((t[1] & t[2]) | (~t[1] & t[3])) + BSHA_OC1; BSHA_N_COP
6464
#define BSHA_N_OP2() x = (t[3] ^ t[2] ^ t[1]) + t[4] + ROL(x, 5) + \
65-
LSB4(*p++) + BSHA_OC2; BSHA_N_COP
65+
LSB4(*p++) + BSHA_OC2; BSHA_N_COP
6666
#define BSHA_N_OP3() x = LSB4(*p++) + ROL(x, 5) + t[4] + \
67-
((t[2] & t[1]) | (t[3] & t[2]) | (t[3] & t[1])) - BSHA_OC3; BSHA_N_COP
67+
((t[2] & t[1]) | (t[3] & t[2]) | (t[3] & t[1])) - BSHA_OC3; BSHA_N_COP
6868
#define BSHA_N_OP4() x = (t[3] ^ t[2] ^ t[1]) + t[4] + ROL(x, 5) + \
69-
LSB4(*p++) - BSHA_OC4; BSHA_N_COP
69+
LSB4(*p++) - BSHA_OC4; BSHA_N_COP
7070
#endif
7171

7272
#if USE_NEW_BSHA1
7373
MEXP(void) calcHashBuf(const char* input, unsigned int length, char* result) {
74-
uint32_t vals[5];
75-
uint32_t t[5]; // a, b, c, d, e
76-
uint32_t buf[0x50];
77-
uint32_t* p;
78-
uint32_t x;
79-
const char* in = input;
80-
unsigned int i, j;
81-
unsigned int sub_length;
82-
83-
/* Initializer Values */
84-
p = vals;
85-
*p++ = BSHA_IC1;
86-
*p++ = BSHA_IC2;
87-
*p++ = BSHA_IC3;
88-
*p++ = BSHA_IC4;
89-
*p++ = BSHA_IC5;
90-
91-
memset(buf, 0, 320); // zero buf
92-
93-
/* Process input in chunks. */
94-
for (i = 0; i < length; i += 0x40) {
95-
sub_length = length - i;
96-
97-
/* Maximum chunk size is 0x40 (64) bytes. */
98-
if (sub_length > 0x40)
99-
sub_length = 0x40;
100-
101-
memcpy(buf, in, sub_length);
102-
in += sub_length;
103-
104-
/* If necessary, pad with zeroes to 64 bytes. */
105-
if (sub_length < 0x40)
106-
memset(buf + sub_length, 0, 0x40 - sub_length);
107-
108-
for (j = 0; j < 64; j++) {
109-
buf[j + 16] =
110-
LSB4(ROL(1, LSB4(buf[j] ^ buf[j+8] ^ buf[j+2] ^ buf[j+13]) % 32));
111-
}
112-
113-
memcpy(t, vals, 20);
114-
p = buf;
115-
116-
/* It's a kind of magic. */
117-
BSHA_N_OP1(); BSHA_N_OP1(); BSHA_N_OP1(); BSHA_N_OP1(); BSHA_N_OP1();
118-
BSHA_N_OP1(); BSHA_N_OP1(); BSHA_N_OP1(); BSHA_N_OP1(); BSHA_N_OP1();
119-
120-
BSHA_N_OP2(); BSHA_N_OP2(); BSHA_N_OP2(); BSHA_N_OP2(); BSHA_N_OP2();
121-
BSHA_N_OP2(); BSHA_N_OP2(); BSHA_N_OP2(); BSHA_N_OP2(); BSHA_N_OP2();
122-
123-
BSHA_N_OP3(); BSHA_N_OP3(); BSHA_N_OP3(); BSHA_N_OP3(); BSHA_N_OP3();
124-
BSHA_N_OP3(); BSHA_N_OP3(); BSHA_N_OP3(); BSHA_N_OP3(); BSHA_N_OP3();
125-
126-
BSHA_N_OP4(); BSHA_N_OP4(); BSHA_N_OP4(); BSHA_N_OP4(); BSHA_N_OP4();
127-
BSHA_N_OP4(); BSHA_N_OP4(); BSHA_N_OP4(); BSHA_N_OP4(); BSHA_N_OP4();
128-
129-
vals[0] += t[0];
130-
vals[1] += t[1];
131-
vals[2] += t[2];
132-
vals[3] += t[3];
133-
vals[4] += t[4];
134-
}
135-
136-
/* Return result. */
137-
memcpy(result, vals, 20);
74+
uint32_t vals[5];
75+
uint32_t t[5]; // a, b, c, d, e
76+
uint32_t buf[0x50];
77+
uint32_t* p;
78+
uint32_t x;
79+
const char* in = input;
80+
unsigned int i, j;
81+
unsigned int sub_length;
82+
83+
/* Initializer Values */
84+
p = vals;
85+
*p++ = BSHA_IC1;
86+
*p++ = BSHA_IC2;
87+
*p++ = BSHA_IC3;
88+
*p++ = BSHA_IC4;
89+
*p++ = BSHA_IC5;
90+
91+
memset(buf, 0, 320); // zero buf
92+
93+
/* Process input in chunks. */
94+
for (i = 0; i < length; i += 0x40) {
95+
sub_length = length - i;
96+
97+
/* Maximum chunk size is 0x40 (64) bytes. */
98+
if (sub_length > 0x40)
99+
sub_length = 0x40;
100+
101+
memcpy(buf, in, sub_length);
102+
in += sub_length;
103+
104+
/* If necessary, pad with zeroes to 64 bytes. */
105+
if (sub_length < 0x40)
106+
memset(buf + sub_length, 0, 0x40 - sub_length);
107+
108+
for (j = 0; j < 64; j++) {
109+
buf[j + 16] =
110+
LSB4(ROL(1, LSB4(buf[j] ^ buf[j+8] ^ buf[j+2] ^ buf[j+13]) % 32));
111+
}
112+
113+
memcpy(t, vals, 20);
114+
p = buf;
115+
116+
/* It's a kind of magic. */
117+
BSHA_N_OP1(); BSHA_N_OP1(); BSHA_N_OP1(); BSHA_N_OP1(); BSHA_N_OP1();
118+
BSHA_N_OP1(); BSHA_N_OP1(); BSHA_N_OP1(); BSHA_N_OP1(); BSHA_N_OP1();
119+
120+
BSHA_N_OP2(); BSHA_N_OP2(); BSHA_N_OP2(); BSHA_N_OP2(); BSHA_N_OP2();
121+
BSHA_N_OP2(); BSHA_N_OP2(); BSHA_N_OP2(); BSHA_N_OP2(); BSHA_N_OP2();
122+
123+
BSHA_N_OP3(); BSHA_N_OP3(); BSHA_N_OP3(); BSHA_N_OP3(); BSHA_N_OP3();
124+
BSHA_N_OP3(); BSHA_N_OP3(); BSHA_N_OP3(); BSHA_N_OP3(); BSHA_N_OP3();
125+
126+
BSHA_N_OP4(); BSHA_N_OP4(); BSHA_N_OP4(); BSHA_N_OP4(); BSHA_N_OP4();
127+
BSHA_N_OP4(); BSHA_N_OP4(); BSHA_N_OP4(); BSHA_N_OP4(); BSHA_N_OP4();
128+
129+
vals[0] += t[0];
130+
vals[1] += t[1];
131+
vals[2] += t[2];
132+
vals[3] += t[3];
133+
vals[4] += t[4];
134+
}
135+
136+
/* Return result. */
137+
memcpy(result, vals, 20);
138138
}
139139

140140
#else
141141

142142
MEXP(void) calcHashBuf(const char* input, size_t length, char* result) {
143143
int i;
144144
unsigned long a, b, c, d, e, g;
145-
uint32_t* ldata;
145+
uint32_t* ldata;
146146
char data[1024];
147147
memset(data, 0, 1024);
148148
memcpy(data, input, length);
149149
ldata = (uint32_t*) data;
150-
150+
151151
for (i = 0; i < 64; i++) {
152152
ldata[i + 16] =
153153
LSB4(ROL(1, LSB4(ldata[i] ^ ldata[i+8] ^ ldata[i+2] ^ ldata[i+13]) % 32));
154154
}
155-
156-
//dumpbuf(data, 1024);
157-
155+
156+
//dumpbuf(data, 1024);
157+
158158
a = BSHA_IC1;
159159
b = BSHA_IC2;
160160
c = BSHA_IC3;
161161
d = BSHA_IC4;
162162
e = BSHA_IC5;
163163
g = 0;
164-
164+
165165
// Loops unrolled.
166166
BSHA_OP1(a, b, c, d, e, *ldata++, g) BSHA_OP1(a, b, c, d, e, *ldata++, g)
167167
BSHA_OP1(a, b, c, d, e, *ldata++, g) BSHA_OP1(a, b, c, d, e, *ldata++, g)

src/bncsutil/bsha1.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extern "C" {
4141
* hash: Buffer, at least 20 bytes in length, to receive the hash.
4242
*/
4343
MEXP(void) calcHashBuf(const char* data, size_t length, char* hash);
44-
44+
4545
/*
4646
* New implementation. Broken. No plans to fix.
4747
*/

0 commit comments

Comments
 (0)