block-employee-directory/EmployeeDirectory/Extensions/URL.swift
Matt Bruce f07089a1fc commented the code.
Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
2025-01-21 09:12:56 -06:00

19 lines
423 B
Swift

//
// URL.swift
// EmployeeDirectory
//
// Created by Matt Bruce on 1/20/25.
//
import Foundation
import CryptoKit
extension URL {
/// This will has the URL absoluteString into a that is consistent.
internal var uniqueIdentifier: String {
let data = Data(absoluteString.utf8)
let hash = SHA256.hash(data: data)
return hash.compactMap { String(format: "%02x", $0) }.joined()
}
}