Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-19 Thread Mindaugas Kavaliauskas
Viktor Szakáts wrote: Now it's better, but in order to make them give the right results with SHA384 and SHA512, 64 has to be changed to 128. I'm lost how to do this in a generic way. Hi, why? 64 bytes (binary, not hex) is 512 bits. So, HMAC is OK up to 512 bits. After reading some docs (rfc

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-19 Thread Viktor Szakáts
Hi Mindaugas, Now it's better, but in order to make them give the right results with SHA384 and SHA512, 64 has to be changed to 128. I'm lost how to do this in a generic way. Brgds, Viktor On Mon, Jan 19, 2009 at 10:03 PM, Mindaugas Kavaliauskas wrote: > Hi, > > > For some reason I still cann

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-19 Thread Viktor Szakáts
Well, Python ranks much higher on my language respect list than PHP, so +1 :) Brgds, Viktor On Mon, Jan 19, 2009 at 10:42 PM, Mindaugas Kavaliauskas wrote: > Viktor Szakáts wrote: > >> hmmm, really strange. In this case I won't add any SHA2 functions to core >> in this fashion. Rather I'll keep

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-19 Thread Mindaugas Kavaliauskas
Viktor Szakáts wrote: hmmm, really strange. In this case I won't add any SHA2 functions to core in this fashion. Rather I'll keep it in hbcrypt() in binary form. Or, if group agrees, we break with the HB_MD5 "habit" and these new ones will use binary data by default. Am I living a different wo

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-19 Thread Viktor Szakáts
I wasn't aware that HB_MD5 is returning a hexa string. In my personaly opinion, but it's probably too late to modify that, such functions should return a binary stream of bytes, and if user wants, it can be easily converted to hex using hb_strtohex(). This way it's properly modular and there's no r

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-19 Thread Viktor Szakáts
hmmm, really strange. In this case I won't add any SHA2 functions to core in this fashion. Rather I'll keep it in hbcrypt() in binary form. Or, if group agrees, we break with the HB_MD5 "habit" and these new ones will use binary data by default. Am I living a different world, or is it true, that i

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-19 Thread Mindaugas Kavaliauskas
Hi, In many cases (ex., communication protocol implementation) we need binary digest result, and hex format is used for human readable representation only. You are right. I'll add support for such parameter. Maybe we should even return binary data by default. What's group decision? No, let'

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-19 Thread Przemyslaw Czerpak
On Mon, 19 Jan 2009, Mindaugas Kavaliauskas wrote: Hi, > P.S. sometimes one more optional parameter would be really usefull > HB_{MD5|SHA1|...}( cMessage [, lBinary ] ), to avoid two unnecessary > Bin->Hex->Bin conversion in function like HB_HMAC: > FUNC HB_HMAC(fHash, cMessage, cKey, lBinary)

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-19 Thread Mindaugas Kavaliauskas
Hi, For some reason I still cannot make pass your generic .prg HMAC function on the validation tests. Probably some stupid mistakes on my part. No, on my one. I forgot one Hex->Bin conversion. It should be: FUNC HB_HMAC(fHash, cMessage, cKey) IF LEN(cKey) > 64; cKey := HB_HexToStr(EVAL(f

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-19 Thread Viktor Szakáts
Thanks Mindaugas. For some reason I still cannot make pass your generic .prg HMAC function on the validation tests. Probably some stupid mistakes on my part. Brgds, Viktor On Mon, Jan 19, 2009 at 4:52 PM, Mindaugas Kavaliauskas wrote: > Hi, > > > We will need an HB_STRXOR(). Does this seem okay

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-19 Thread Przemyslaw Czerpak
On Mon, 19 Jan 2009, Mindaugas Kavaliauskas wrote: Hi, > Some parameter error detection is done (I'm not sure that error subcode we > should use, so, I've used 3012, just like in HB_STRTOHEX()). String is not > reallocated if xor'ing to empty string or zero byte. Feel free to commit > this cod

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-19 Thread Mindaugas Kavaliauskas
Hi, We will need an HB_STRXOR(). Does this seem okay (UCHAR vs. BYTE might be wrong here): Oh, yes, I forgot it's my function, not Harbour's. I use code: HB_FUNC( HB_STRXOR ) { PHB_ITEMpItem, pItem2; ULONG ulLen1, ulLen2, ul, ul2; const char *pStr1, *pStr2; char*

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-19 Thread Viktor Szakáts
uhttpd seems good to me. Brgds, Viktor On Mon, Jan 19, 2009 at 2:31 AM, Mindaugas Kavaliauskas wrote: > Francesco Saverio Giudice wrote: > >> Ok, I'll do, if Mindaugas agree. Do you have a name proposal ? >> I think we can name it webserver (what fantasy ;-) ). >> One version I have is based on M

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-19 Thread Viktor Szakáts
Hi Mindaugas, > I didn't deal with SHA1 because it isn't considered safe anymore (just like >> MD5). It can easily be added, given we find an implementation with a Harbour >> compatible licence. >> > > MD5 and SHA1 is still used in many standards. You can use stronger hashing > in your applicatio

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-18 Thread Mindaugas Kavaliauskas
Francesco Saverio Giudice wrote: Ok, I'll do, if Mindaugas agree. Do you have a name proposal ? I think we can name it webserver (what fantasy ;-) ). One version I have is based on Mindaugas version with socket.c and it is fast and stable. Another is based on inet*() version, that offers actual

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-18 Thread Mindaugas Kavaliauskas
Hi, I didn't deal with SHA1 because it isn't considered safe anymore (just like MD5). It can easily be added, given we find an implementation with a Harbour compatible licence. MD5 and SHA1 is still used in many standards. You can use stronger hashing in your application, but you'll need th

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-18 Thread Francesco Saverio Giudice
Hi Viktor, Il 18/01/2009 2.29, Viktor Szakáts ha scritto: Maybe we should upload it, and continue to extend the code online, it's a very important addition, and everyone could benefit from it. It could go to /contrib/examples/<...>/ as is. Ok, I'll do, if Mindaugas agree. Do you have a name

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-18 Thread Viktor Szakáts
Hi Mindaugas, Many thanks for the feedback. 1) it would be nice to have C also interface and to have names compatible to > existing MD5 hasing; The C interface is there, a Harbour C namespace (and MD5 function) compatible layer can easily be added. > 2) SHA1 is also member of the family and o

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-17 Thread Mindaugas Kavaliauskas
Viktor Szakáts wrote: Pls see a Harbour library which implements SHA2 related checksumming and SHA2 MAC creation, here: http://www.syenar.hu/harbour/hbsha2.zip Usage from .prg: HB_SHA224( ) -> HB_SHA256( ) -> HB_SHA384( ) -> HB_SHA512( ) -> HB_SHA224_HMAC( , ) -> HB_SHA256_HMAC( ,

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-17 Thread Viktor Szakáts
Hi Francesco, > A question: anyone has played with SSL support ? I'm interested about it > because I'm playing with Mindaugas uhttpd code (I've extended it a little). > Maybe we should upload it, and continue to extend the code online, it's a very important addition, and everyone could benefit f

Re: [Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-17 Thread Francesco Saverio Giudice
Hi Viktor, Il 17/01/2009 23.26, Viktor Szakáts ha scritto: Pls see a Harbour library which implements SHA2 related checksumming and SHA2 MAC creation, here: Great addition! I will try. Thank you. A question: anyone has played with SSL support ? I'm interested about it because I'm playing wit

[Harbour] Harbour SHA2 and SHA2-HMAC support

2009-01-17 Thread Viktor Szakáts
Hi all, Pls see a Harbour library which implements SHA2 related checksumming and SHA2 MAC creation, here: http://www.syenar.hu/harbour/hbsha2.zip Usage from .prg: HB_SHA224( ) -> HB_SHA256( ) -> HB_SHA384( ) -> HB_SHA512( ) -> HB_SHA224_HMAC( , ) -> HB_SHA256_HMAC( , ) -> HB_SHA384_H