Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 11b5811

Browse files
remove test code from aes pwd2key.c
1 parent 4fd36e8 commit 11b5811

File tree

1 file changed

+0
-90
lines changed

1 file changed

+0
-90
lines changed

ios/CodePush/SSZipArchive/aes/pwd2key.c

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -101,93 +101,3 @@ void derive_key(const unsigned char pwd[], /* the PASSWORD */
101101
key[k++] = ux[j++];
102102
}
103103
}
104-
105-
#ifdef TEST
106-
107-
#include <stdio.h>
108-
109-
struct
110-
{ unsigned int pwd_len;
111-
unsigned int salt_len;
112-
unsigned int it_count;
113-
unsigned char *pwd;
114-
unsigned char salt[32];
115-
unsigned char key[32];
116-
} tests[] =
117-
{
118-
{ 8, 4, 5, (unsigned char*)"password",
119-
{
120-
0x12, 0x34, 0x56, 0x78
121-
},
122-
{
123-
0x5c, 0x75, 0xce, 0xf0, 0x1a, 0x96, 0x0d, 0xf7,
124-
0x4c, 0xb6, 0xb4, 0x9b, 0x9e, 0x38, 0xe6, 0xb5
125-
}
126-
},
127-
{ 8, 8, 5, (unsigned char*)"password",
128-
{
129-
0x12, 0x34, 0x56, 0x78, 0x78, 0x56, 0x34, 0x12
130-
},
131-
{
132-
0xd1, 0xda, 0xa7, 0x86, 0x15, 0xf2, 0x87, 0xe6,
133-
0xa1, 0xc8, 0xb1, 0x20, 0xd7, 0x06, 0x2a, 0x49
134-
}
135-
},
136-
{ 8, 21, 1, (unsigned char*)"password",
137-
{
138-
"ATHENA.MIT.EDUraeburn"
139-
},
140-
{
141-
0xcd, 0xed, 0xb5, 0x28, 0x1b, 0xb2, 0xf8, 0x01,
142-
0x56, 0x5a, 0x11, 0x22, 0xb2, 0x56, 0x35, 0x15
143-
}
144-
},
145-
{ 8, 21, 2, (unsigned char*)"password",
146-
{
147-
"ATHENA.MIT.EDUraeburn"
148-
},
149-
{
150-
0x01, 0xdb, 0xee, 0x7f, 0x4a, 0x9e, 0x24, 0x3e,
151-
0x98, 0x8b, 0x62, 0xc7, 0x3c, 0xda, 0x93, 0x5d
152-
}
153-
},
154-
{ 8, 21, 1200, (unsigned char*)"password",
155-
{
156-
"ATHENA.MIT.EDUraeburn"
157-
},
158-
{
159-
0x5c, 0x08, 0xeb, 0x61, 0xfd, 0xf7, 0x1e, 0x4e,
160-
0x4e, 0xc3, 0xcf, 0x6b, 0xa1, 0xf5, 0x51, 0x2b
161-
}
162-
}
163-
};
164-
165-
int main()
166-
{ unsigned int i, j, key_len = 256;
167-
unsigned char key[256];
168-
169-
printf("\nTest of RFC2898 Password Based Key Derivation");
170-
for(i = 0; i < 5; ++i)
171-
{
172-
derive_key(tests[i].pwd, tests[i].pwd_len, tests[i].salt,
173-
tests[i].salt_len, tests[i].it_count, key, key_len);
174-
175-
printf("\ntest %i: ", i + 1);
176-
printf("key %s", memcmp(tests[i].key, key, 16) ? "is bad" : "is good");
177-
for(j = 0; j < key_len && j < 64; j += 4)
178-
{
179-
if(j % 16 == 0)
180-
printf("\n");
181-
printf("0x%02x%02x%02x%02x ", key[j], key[j + 1], key[j + 2], key[j + 3]);
182-
}
183-
printf(j < key_len ? " ... \n" : "\n");
184-
}
185-
printf("\n");
186-
return 0;
187-
}
188-
189-
#if defined(__cplusplus)
190-
}
191-
#endif
192-
193-
#endif

0 commit comments

Comments
 (0)