Unify SHA256 hash and hex usages (#687)

This commit is contained in:
Islam
2025-09-30 12:47:16 +02:00
committed by GitHub
parent f5af00be88
commit 78fb3f1bf6
14 changed files with 50 additions and 82 deletions
+22
View File
@@ -0,0 +1,22 @@
//
// Data+SHA256.swift
// bitchat
//
// Created by Islam on 26/09/2025.
//
import struct Foundation.Data
import struct CryptoKit.SHA256
extension Data {
/// Returns the hex representation of SHA256 hash
func sha256Fingerprint() -> String {
// Implementation matches existing fingerprint generation in NoiseEncryptionService
sha256Hash().hexEncodedString()
}
/// Returns the SHA256 hash wrapped in Data
func sha256Hash() -> Data {
Data(SHA256.hash(data: self))
}
}