mirror of
https://github.com/luxfhe/example-ios-demo.git
synced 2026-10-30 18:13:24 +00:00
This app is ZAMA's BSD 3-Clause Clear demo. The license requires its notices to survive redistribution, and a rebrand had replaced every one of them with ours: the LICENSE text, 66 source headers and the app's copyright string. They are back, each with our line beside it for our changes. Co-authored-by: Hanzo Dev <[email protected]>
20 lines
606 B
Swift
20 lines
606 B
Swift
// Copyright © 2025 Zama. All rights reserved.
|
|
// Copyright © 2025 Lux Industries Inc.
|
|
|
|
import CryptoKit
|
|
import Foundation
|
|
|
|
extension Data {
|
|
/// Replacement for `Data.hashValue`, which is not designed for persistence or cryptographic use.
|
|
var stableHashValue: String {
|
|
sha256Identifier
|
|
}
|
|
|
|
// Secure and stable across launches (Always produces the same output for the same input).
|
|
// MD5 is stable but unsecure
|
|
private var sha256Identifier: String {
|
|
let digest = SHA256.hash(data: self)
|
|
return digest.map { String(format: "%02x", $0) }.joined()
|
|
}
|
|
}
|