1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | #import <Foundation/Foundation.h>
|
12 | #include "tommath.h"
|
13 |
|
14 | @interface JKBigInteger : NSObject <NSSecureCoding>
|
15 |
|
16 | - (id)initWithValue:(mp_int *)value;
|
17 | - (mp_int *)value;
|
18 |
|
19 | - (id)initWithUnsignedLong:(unsigned long)ul;
|
20 | - (id)initWithString:(NSString *)string;
|
21 | - (id)initWithString:(NSString *)string andRadix:(int)radix;
|
22 | - (id)initWithCString:(char *)cString;
|
23 | - (id)initWithCString:(char *)cString andRadix:(int)radix;
|
24 |
|
25 | - (id)add:(JKBigInteger *)bigInteger;
|
26 | - (id)subtract:(JKBigInteger *)bigInteger;
|
27 | - (id)multiply:(JKBigInteger *)bigInteger;
|
28 | - (id)divide:(JKBigInteger *)bigInteger;
|
29 |
|
30 | - (id)remainder:(JKBigInteger *)bigInteger;
|
31 | - (NSArray *)divideAndRemainder:(JKBigInteger *)bigInteger;
|
32 |
|
33 | - (id)pow:(unsigned int)exponent;
|
34 | - (id)pow:(JKBigInteger*)exponent andMod:(JKBigInteger*)modulus;
|
35 | - (id)negate;
|
36 | - (id)abs;
|
37 |
|
38 | - (id)bitwiseXor:(JKBigInteger *)bigInteger;
|
39 | - (id)bitwiseOr:(JKBigInteger *)bigInteger;
|
40 | - (id)bitwiseAnd:(JKBigInteger *)bigInteger;
|
41 | - (id)shiftLeft:(unsigned int)n;
|
42 | - (id)shiftRight:(unsigned int)n;
|
43 |
|
44 | - (id)gcd:(JKBigInteger *)bigInteger;
|
45 |
|
46 | - (NSComparisonResult) compare:(JKBigInteger *)bigInteger;
|
47 |
|
48 | - (unsigned long)unsignedIntValue;
|
49 | - (NSString *)stringValue;
|
50 | - (NSString *)stringValueWithRadix:(int)radix;
|
51 |
|
52 | - (NSString *)description;
|
53 |
|
54 | - (unsigned int)countBytes;
|
55 | - (void)toByteArraySigned: (unsigned char*) byteArray;
|
56 | - (void)toByteArrayUnsigned: (unsigned char*) byteArray;
|
57 |
|
58 | @end
|