![]() |
| | #1 |
| Registered User Join Date: May 2009
Posts: 2
| /0 char within a char array? The PBKDF2 spec section I am having trouble with is below Code: where
U_1 = PRF (P, S || INT (i)) ,
U_2 = PRF (P, U_1) ,
...
U_c = PRF (P, U_{c-1}) .
Here, INT (i) is a four-octet encoding of the integer i, mostsignificant octet first.
I tried using other values, like '0' which didnt work because its value was not actually 0. Thank you for any help. Some of the code. Code: char U[14+5]; // my test salt is 14 characters
char appended[] = {(char)0, (char)0, (char)0, (char)i, '\0'};
strcpy(U,S);
for (j=0;j<5;++j)
{
U[14+j] = appended[j];
}
Code: HMAC(U,P); Code: void HMAC(char* text, char* key) hmac_sha1.c Last edited by bryon; 05-02-2009 at 08:46 PM. |
| bryon is offline | |
| | #2 |
| +++ OK NO CARRIER Join Date: Oct 2001
Posts: 10,259
| You can have null characters in your arrays of characters, if you treat them as that: arrays of charaters, and not as strings. That means no using string functions, and passing the actual size of the array along to whatever function uses it. So stop treating them as strings, and start treating them as arrays of characters of a specified size, and you should be fine. Quzah.
__________________ Hundreds of thousands of dipshits can't be wrong. Are you up for the suck? |
| quzah is offline | |
| | #3 |
| Registered User Join Date: May 2009
Posts: 2
| Thank you! That and a few corrected wrong turns made it all work. Also, thanks for your quick reply, I've been working feverishly since your post and it all works now. |
| bryon is offline | |
![]() |
| Tags |
| '/0', char, char array, pbkdf2, strings |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Why return malloc'd char array not work, but local char array does? | 6tr6tr | C++ Programming | 3 | 11-17-2008 12:36 PM |
| code condensing | bcianfrocca | C++ Programming | 4 | 09-07-2005 09:22 AM |
| code help required | Yobbo | C Programming | 9 | 09-02-2005 11:15 PM |
| Creating 2D arrays on heap | sundeeptuteja | C++ Programming | 6 | 08-16-2002 11:44 AM |
| Strings are V important... | NANO | C++ Programming | 15 | 04-14-2002 11:57 AM |