Return just <masked> when masked description

Why bother with useless hashes?
This commit is contained in:
Davide De Rosa 2019-05-19 11:04:54 +02:00
parent d19e029131
commit 470c50b037
1 changed files with 8 additions and 8 deletions

View File

@ -36,7 +36,6 @@
import Foundation import Foundation
import __TunnelKitNative import __TunnelKitNative
import CommonCrypto
struct CoreConfiguration { struct CoreConfiguration {
static let identifier = "com.algoritmico.TunnelKit" static let identifier = "com.algoritmico.TunnelKit"
@ -116,12 +115,13 @@ extension CustomStringConvertible {
guard CoreConfiguration.masksPrivateData else { guard CoreConfiguration.masksPrivateData else {
return description return description
} }
var data = description.data(using: .utf8)! // var data = description.data(using: .utf8)!
let dataCount = CC_LONG(data.count) // let dataCount = CC_LONG(data.count)
var md = Data(count: Int(CC_SHA1_DIGEST_LENGTH)) // var md = Data(count: Int(CC_SHA1_DIGEST_LENGTH))
md.withUnsafeMutableBytes { // md.withUnsafeMutableBytes {
_ = CC_SHA1(&data, dataCount, $0.bytePointer) // _ = CC_SHA1(&data, dataCount, $0.bytePointer)
} // }
return "#\(md.toHex().prefix(16))#" // return "#\(md.toHex().prefix(16))#"
return "<masked>"
} }
} }