hohl / MIHCrypto

OpenSSL wrapper for Objective-C [cryptography]
MIT License
341 stars 68 forks source link

Refactor MIHBigInteger#initWithData to use BN_bin2bn instead of BN_mpi2bn #18

Closed akhilstanis closed 9 years ago

akhilstanis commented 9 years ago

The current MIHBigInteger#initWithData: uses BN_mpi2bn which which doesn't seem to be the right option when there is BN_bin2bn, and so I refactored the method to use latter mentioned function. Also I have added MIHBigInteger#initWithMpiData: to add support for BN_mpi2bn too.

hohl commented 9 years ago

You are right. In fact the whole MIHCoding design is a bit miss-designed. It would be better to have something like - initWithData:(NSData *)someData format:(MIHDataFormat)aFormat. There is often the case where you have multiple data types available.

hohl commented 9 years ago

Thank you very much for your help. Since I'm planing a release with breaking changes I merged this change too.