Fix Linux build
- Commit
7a81f904c13fd83e68933808326f3b1347b91887- Author
- Kabir Oberai <[email protected]>
- When
- 2022-07-24 19:38 UTC (4 years ago)
- Parents
bc9603a
It's not worth adding swift-crypto for one function so we just use OpenSSL
Diff
Supersign/Sources/Supersign/GrandSlam/Anisette/ADIDataProvider.swift
diff --git a/Supersign/Sources/Supersign/GrandSlam/Anisette/ADIDataProvider.swift b/Supersign/Sources/Supersign/GrandSlam/Anisette/ADIDataProvider.swiftindex 2c7f638..886ac79 100644--- a/Supersign/Sources/Supersign/GrandSlam/Anisette/ADIDataProvider.swift+++ b/Supersign/Sources/Supersign/GrandSlam/Anisette/ADIDataProvider.swift@@ -1,13 +1,18 @@ import Foundation-import CryptoKit+import CSupersign enum HashingError: Error { case hashingFailed } private extension String {- func sha256() throws -> SHA256Digest {- SHA256.hash(data: Data(utf8))+ func sha256() throws -> [UInt8] {+ try [UInt8](unsafeUninitializedCapacity: sup_sha256_buf_size()) { buf, count in+ guard sup_sha256(self, utf8.count, buf.baseAddress!) == 0 else {+ throw HashingError.hashingFailed+ }+ count = buf.count+ } } }