Hi Adam,

> auth.cpp:32: error: expected type-specifier before 'HexEncoder'
CryptoPP::HexEncoder

> byte key [ HMAC<SHA1>::DIGESTSIZE ] =
> {0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b}; and changed the string
> to "Hi There", but it said the key was too long.

You have four choices:
1) You can keep guessing
2) You can examine the Crypto++ source code and retrieve the value
2) You can visit a site that discusses SHA1 and read the length of the digest
4) You can try a sample such as below:
int length = HMAC<SHA1>::DIGESTSIZE;
printf("%d", length);

> What other changes would I need to do to use those test cases etc?
Work on the digest size issue first.

Jeff

On Wed, Jun 11, 2008 at 10:11 AM, Adam Harding
<[EMAIL PROTECTED]> wrote:
>
> Got it working now and printing out the result with the printf
> function so really happy with that! Thankyou.
>
> I could not get it working with the String Source bit though. I
> included #include "hex.h but got these errors:
>
> auth.cpp: In function 'int main(int, char**)':
> auth.cpp:32: error: expected type-specifier before 'HexEncoder'
> auth.cpp:32: error: expected `)' before 'HexEncoder'
> auth.cpp:32: error: 'StringSource' was not declared in this scope
>
>
> And lastly just want to just use some of the RFC test cases, so just a
> few question on that and that should be it really!
>
> Here are  two test cases:
>
> test_case =     1
> key =           0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
> key_len =       20
> data =          "Hi There"
> data_len =      8
> digest =        0xb617318655057264e28bc0b6fb378c8ef146be00
>
> test_case =     2
> key =           "Jefe"
> key_len =       4
> data =          "what do ya want for nothing?"
> data_len =      28
> digest =        0xeffcdf6ae5eb2fa2d27416d5f184df9c259a7c79
>
>
> So is the "digest =" the result I should also be getting from my mac
> print out if I use the same key and data?
>
> With the first test case I copied in the full key
>
> byte key [ HMAC<SHA1>::DIGESTSIZE ] =
> {0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b}; and changed the string
> to "Hi There", but it said the key was too long.
>
> On the 2nd test case I did:   byte key [ HMAC<SHA1>::DIGESTSIZE ] =
> {"Jefe"};
> and changed the string  "what do ya want for nothing?". It compiled
> and I got a result but it did not match the digest listed on the test
> case.
>
> What other changes would I need to do to use those test cases etc?
>
> Thanks alot.
> Adam.
>
> [SNIP]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to