hohl / MIHCrypto

OpenSSL wrapper for Objective-C [cryptography]
MIT License
340 stars 66 forks source link

Add missing initialization methods to MIHBigInteger #15

Closed akhilstanis closed 10 years ago

akhilstanis commented 10 years ago

Initialization of MIHBigIntegers with hex string and signed ints were missing. Here is a patch with those missing initializers.

- (id)initWithHexStringValue:(NSString *)hexString;
- (id)initWithSignedInteger:(BN_LONG)value;

Also another initializer I found to be missing is initializing a new big number with raw bytes ie., BN_bin2bn I saw you have used BN_mpi2bn in initWithData and that makes sense. But I would like to add an initializer which uses BN_bin2bn too, what do you think will be a good name for that initializer?

hohl commented 10 years ago

Thanks. Looks fine.

hohl commented 10 years ago

It's hard to find a good name for BIN. Maybe it would have been a good decision to call them 'initWithRawData:' and 'initWithMpiData:'.