{"id":15293658,"url":"https://github.com/hyugit/uint256","last_synced_at":"2026-01-16T12:27:47.532Z","repository":{"id":56925188,"uuid":"115822895","full_name":"hyugit/UInt256","owner":"hyugit","description":"An UInt256 library written in Swift 4","archived":false,"fork":false,"pushed_at":"2025-02-14T04:11:58.000Z","size":97,"stargazers_count":23,"open_issues_count":0,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T05:47:42.937Z","etag":null,"topics":["algo","algorithm","bigint","biginteger","carthage","cocoapods","divide-and-conquer","ios","karatsuba-multiplication","macos","playground","swift","swift-package-manager","swift4","uint256"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyugit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-30T20:45:46.000Z","updated_at":"2025-02-14T04:12:03.000Z","dependencies_parsed_at":"2022-08-20T22:50:29.746Z","dependency_job_id":null,"html_url":"https://github.com/hyugit/UInt256","commit_stats":null,"previous_names":["mryu87/uint256"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyugit%2FUInt256","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyugit%2FUInt256/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyugit%2FUInt256/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyugit%2FUInt256/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyugit","download_url":"https://codeload.github.com/hyugit/UInt256/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248721131,"owners_count":21151050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algo","algorithm","bigint","biginteger","carthage","cocoapods","divide-and-conquer","ios","karatsuba-multiplication","macos","playground","swift","swift-package-manager","swift4","uint256"],"created_at":"2024-09-30T16:50:26.531Z","updated_at":"2025-12-11T23:01:55.551Z","avatar_url":"https://github.com/hyugit.png","language":"Swift","readme":"# UInt256\n\n[![Build Status](https://travis-ci.org/hyugit/UInt256.svg?branch=master)](https://travis-ci.org/hyugit/UInt256)\n[![Language](https://img.shields.io/badge/swift-4-orange.svg)](https://swift.org)\n[![Platform](https://img.shields.io/badge/platform-ios%20|%20macos-lightgrey.svg)](https://github.com/hyugit/UInt256)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-green.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![CocoaPods Compatible](https://img.shields.io/badge/CocoaPods-compatible-green.svg?style=flat)](https://cocoapods.org/)\n[![Coverage Status](https://coveralls.io/repos/github/hyugit/UInt256/badge.svg)](https://coveralls.io/github/hyugit/UInt256)\n\n\nA UInt256 library written in Swift 4, **inspired** by [CryptoCoinSwift/UInt256](https://github.com/CryptoCoinSwift/UInt256)\n\n## Features\n\nThis library provides a UInt256 struct that conforms nicely to Swift's **FixedWidthInteger** and **UnsignedInteger** protocols. According to Apple, the two are the necessary top level protocols for an UInt member: [here](https://github.com/apple/swift-evolution/blob/master/proposals/0104-improved-integers.md#proposed-solution)\n\nIt supports a complete set of arithmetic operations, as well as properties and functions that are common to other UInt family members such as `UInt64`, `UInt32`, `UInt8`, etc. The library leverages [Karatsuba fast multiplication](https://en.wikipedia.org/wiki/Karatsuba_algorithm) algorithm, [Divide and Conquer](http://bioinfo.ict.ac.cn/~dbu/AlgorithmCourses/Lectures/Hasselstrom2003.pdf) division algorithm, [Barrett Algorithm](https://members.loria.fr/PZimmermann/mca/mca-cup-0.5.9.pdf) for division and other efficient algos for other operators. Other features include integer literal representation (`ExpressibleByIntegerLiteral`), default description (`CustomStringConvertible`) and `Hashable`.\n\nThe library is written entirely in **Swift 4**. It can be installed as a **Swift Package**, a **Carthage package** or a **CocoaPod**. And a playground is also included as a testbench.\n\nPlease feel free to submit new feature requests and report issues here on GitHub. :smiley:\n\n### Please use the playground to try out all the features!\n\n## Swift Protocol Conformance\n\nThe main struct UInt256 conforms strictly to the following protocols: \n - **FixedWidthInteger**\n - **UnsignedInteger**\n - **BinaryInteger**\n - **Numeric**\n - **Comparable**\n - **Equatable**\n - **CustomStringConvertible**\n - **Hashable**\n \n## Requirements\n\n - iOS 8.0+ / macOS 10.10+\n - Xcode 8.0+\n - Swift 4\n\n## Communication\n\nIf you need any help or have a feature request, please open an issue here on GitHub;\nif you found a bug or want to help with the development, please submit a pull request.\nAll contributions are welcome! :smiley:\n\n## Installation\n\n### Carthage\n\nFirst, make sure have Carthage installed:\n\n```\nbrew update\nbrew install carthage\n```\n\nTo integrate this library into your Xcode project, simply put the following line into\nyour `carfile`:\n\n```\ngithub \"hyugit/UInt256\"\n```\n\nFinally, run `carthage update` to build the framework, and drag the built framework\n(either `UInt256_iOS.framework` or `UInt256_macOS.framework`) into your Xcode project\n\n### Swift Package Manager\n\nThis library supports **Swift Package Manager** as well. If you have your swift package\nconfig set up already, please add the following line to your **Package.swift**:\n\n```\ndependencies: [\n    .package(url: \"https://github.com/hyugit/UInt256.git\", from: \"4.0.0\")\n]\n```\n\n### CocoaPods\n\nInstall CocoaPods following its [official guide](http://guides.cocoapods.org/using/getting-started.html#installation)\n\nTo integrate UInt256 into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '10.0'\nuse_frameworks!\n\ntarget '\u003cYour Target Name\u003e' do\n    pod 'UInt256', :git =\u003e 'https://github.com/hyugit/UInt256.git'\nend\n```\n\nAnd run `pod install` afterwards.\n\n### Manual installation\n\nYou can also add this library manually to your project.\n\nIn the terminal, under your top level project directory, add this library as a\n`git submodule` by running the following command:\n\n```\ngit submodule add https://github.com/hyugit/UInt256.git\n```\n\nHave Xcode open, go to your new `UInt256` subdirectory in Finder, drag\n`UInt256.xcodeproj` into the project navigator of your project. _Remember to embed\nthe framework to your build target._\n\n## Next steps...\n\n - [ ] add documentation\n - [ ] look into leveraging GPU/Metal\n - [x] benchmark\n - [x] make UInt256 conform to FixedWidthInteger\n - [x] add an example, preferably through a playground\n - [x] add CocoaPods support\n - [x] more tests, test coverage, corner cases, lint, code review\n - [x] automate build and test runs\n - [x] karatsuba multiplication\n - [x] fast modulo, division, and other algos\n\n## License\n\nThis library is released under the MIT license. Please see [LICENSE](https://github.com/hyugit/UInt256/blob/master/LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyugit%2Fuint256","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyugit%2Fuint256","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyugit%2Fuint256/lists"}