[OT] Re: using os x's built-in blowfish
[OT] Re: using os x's built-in blowfish
- Subject: [OT] Re: using os x's built-in blowfish
- From: "Alastair J.Houghton" <email@hidden>
- Date: Sat, 9 Aug 2003 12:36:22 +0100
On Saturday, August 9, 2003, at 11:02 am, Benjamin Salanki wrote:
hi,
i came across os x's built-in blowfish headers and thought i'd give
them a try. I managed to create a key, and then successfully run
void BF_encrypt(BF_LONG *data,const BF_KEY *key);
void BF_decrypt(BF_LONG *data,const BF_KEY *key);
and it worked like a charm. But my problem is that if i have an NSData,
i pass [NSData length] as the *data parameter to both encrypt and
(You should have been using NSMutableData here, because BF_encrypt and
BF_decrypt modify the 64-bits pointed to by "data". Having said that
though, you shouldn't be using BF_encrypt() or BF_decrypt()...)
You should be using BF_ecb_encrypt(), BF_cbc_encrypt(),
BF_cfb64_encrypt() or BF_ofb64_encrypt(), depending on what you want to
do. Try reading Schneier's "Applied Cryptography", which is a good
introduction to the terminology (it will tell you what ECB and CBC
mean, for example). Also, read the manual page for blowfish (type "man
blowfish" in Terminal).
Remember that output data needs to be in an NSMutableData, because you
aren't supposed to change the contents of NSData.
Kind regards,
Alastair.
p.s. This is off-topic for Cocoa-dev; Omni Group's MacOS X-dev list
would have been a better place to post this question (although many of
us read both, so you'll probably receive the same set of answers anyway
;->).
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.