GHBigNum 0.1.7

GHBigNum 0.1.7

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Sep 2015

Maintained by Gabriel Handford.


Downloads

Total365
Week0
Month0

Installs

Apps30
Test Targets4
powered by Segment

GitHub

Stars2
Watchers1
Forks1
Issues0
Contributors1
Pull Requests0

Code

Files3
LOCLines of Code 96


GHBigNum 0.1.7

  • By
  • Gabriel Handford

BigNum library for Objective-C. Uses OpenSSL.

Install

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects.

Podfile

platform :ios, "7.0"
pod "GHBigNum"

This only includes a few bignum methods that I needed, so its still a work in progress.

a^p % m

GHBigNum *a = [GHBigNum bigNumWithDecimalString:@"3487438743234789234879"];
GHBigNum *p = [GHBigNum bigNumWithDecimalString:@"22"];
GHBigNum *m = [GHBigNum bigNumWithDecimalString:@"43234789234880"];
GHBigNum *r = [GHBigNum modPow:a p:p m:m];

(a*r) % m == 1

GHBigNum *a = [GHBigNum bigNumWithDecimalString:@"3487438743234789234879"];
GHBigNum *m = [GHBigNum bigNumWithDecimalString:@"743234789234880"];
GHBigNum *r = [GHBigNum modInverse:a m:m];

Prime

GHBigNum *bn = [GHBigNum generatePrime:512];
[bn isPrime]; // YES