-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Swift Package Manager (Merge conflicts resolved) (#231)
- Loading branch information
1 parent
bd094a3
commit a047a71
Showing
8 changed files
with
87 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,4 @@ Carthage/Checkouts | |
Carthage/Build | ||
|
||
.DS_Store | ||
.swiftpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// swift-tools-version:5.2 | ||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "SwiftyRSA", | ||
products: [ | ||
.library( | ||
name: "SwiftyRSA", | ||
type: .dynamic, | ||
targets: ["SwiftyRSA"]), | ||
], | ||
dependencies: [ | ||
], | ||
targets: [ | ||
.target( | ||
name: "SwiftyRSA", | ||
dependencies: [], | ||
path: "Source") | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// Data+SHA.swift | ||
// | ||
// | ||
// Created by Joanna Bednarz on 02/10/2020. | ||
// | ||
|
||
import Foundation | ||
import CommonCrypto | ||
|
||
extension Data { | ||
|
||
func swiftyRSASHA1() -> Data { | ||
var digest = [UInt8](repeating: 0, count: Int(CC_SHA1_DIGEST_LENGTH)) | ||
withUnsafeBytes { (buffer: UnsafeRawBufferPointer) in | ||
_ = CC_SHA1(buffer.baseAddress, CC_LONG(count), &digest) | ||
} | ||
return Data(digest) | ||
} | ||
|
||
func swiftyRSASHA224() -> Data { | ||
var digest = [UInt8](repeating: 0, count: Int(CC_SHA224_DIGEST_LENGTH)) | ||
withUnsafeBytes { (buffer: UnsafeRawBufferPointer) in | ||
_ = CC_SHA224(buffer.baseAddress, CC_LONG(count), &digest) | ||
} | ||
return Data(digest) | ||
} | ||
|
||
func swiftyRSASHA256() -> Data { | ||
var digest = [UInt8](repeating: 0, count: Int(CC_SHA256_DIGEST_LENGTH)) | ||
withUnsafeBytes { (buffer: UnsafeRawBufferPointer) in | ||
_ = CC_SHA256(buffer.baseAddress, CC_LONG(count), &digest) | ||
} | ||
return Data(digest) | ||
} | ||
|
||
func swiftyRSASHA384() -> Data { | ||
var digest = [UInt8](repeating: 0, count: Int(CC_SHA384_DIGEST_LENGTH)) | ||
withUnsafeBytes { (buffer: UnsafeRawBufferPointer) in | ||
_ = CC_SHA384(buffer.baseAddress, CC_LONG(count), &digest) | ||
} | ||
return Data(digest) | ||
} | ||
|
||
func swiftyRSASHA512() -> Data { | ||
var digest = [UInt8](repeating: 0, count: Int(CC_SHA512_DIGEST_LENGTH)) | ||
withUnsafeBytes { (buffer: UnsafeRawBufferPointer) in | ||
_ = CC_SHA512(buffer.baseAddress, CC_LONG(count), &digest) | ||
} | ||
return Data(digest) | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters