Hi,

http://www.schneier.com/blowfish.html says: "It takes a
variable-length key, from 32 bits to 448 bits ..."
Is cPass parameter a key? Or key is computed using this password?

<cPass> is the key from above description which is transformed to <bfKey>
used in encryption/decryption algorithm by hb_blowfishInit() function.

I've looked to the details of BF. It's clear now. Usually key size is equal to block size, and password is transformed into the key. BF uses another approach.


Technically you can use any non empty string as cPass. Bytes from
cPass are used cyclically to create 32bit values used to xor keys
in p-array. The implementation I committed does not follow the original
BlowFish description but rather reference implementations which instead
of xoring keys from 1 to 14 xors all 18 keys. It means that insted of
448 bits upto 576 bits from passsed cPass is used.

I guess 448bits is not a problem. Anyone can write LEFT(cPassword, 56) if he wants a strict compatibility with another software. BTW, sample implementation presented by the author at http://www.schneier.com/code/bfsh-sch.zip does not contains limit on password length also.

I've looked to key length encoding in Harbour level functions. Is it some standard way to encode length of 8byte unaligned data? I find useful to add a function hb_blofish{En|De}cryptRaw() (or 3rd optional lRaw=.F. parameter in current functions), for those who has aligned data and are unable to store a longer encrypted data. It will also allow to encrypt/decrypt large amount of data (eg. files) in multiple function calls. The last call can be made without lRaw=.T. parameter to force encoding of unaligned data length if necessary.


Thanks, regards,
Mindaugas

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to